<style lang="less">
  .el-tabs__header{
    margin-bottom: 0;
  }
  .el-radio+.el-radio{
    margin-left: 10px;
  }
  #orderId,#orderSelect{
    height: 28px;
    padding-left: 5px;
    font-size: 12px;
  }
  #orderSelect{
    padding-right: 20px;
  }
  .el-input__inner{
    padding: 0 5px;
  }
  .el-input--suffix .el-input__inner{
    padding-right: 25px;
  }
  #searchButton{
    height: 30px;
  }
  .el-table td, .el-table th{
    padding: 3px 0;
  }
  @media screen and (min-width: 1024px) and (max-width: 1366px){
    .el-table__header-wrapper{
      font-size: 12px;
    }
    .el-table--scrollable-x .el-table__body-wrapper{
      font-size: 12px;
    }
  }
</style>
<template>
  <!--右侧板块型组件-->
  <div class="box_content">
    <!--订单确认板块-->
    <div class="getRoom" v-if="formCon[0]">
      <div class="gr_top">
          <!--开房板块-->
          <div class="content">
            <div class="title" v-if="order_parameter.orderStatus == undefined">订单确认</div>
            <div class="title" v-if="order_parameter.orderStatus == 0">订单详情 {{order_parameter.order_No}}</div>
            <!--会员卡资料-->
            <div class="userInfo">

              <div class="userCon" id="is_activate" v-if="!is_activate && userId != ''">会员未激活</div>
              <!--会员号-->
              <div class="userCon searchUser">
                <span>会员号</span>
                <div class="input">
                  <input id="userId" type="text" v-model="userId" placeholder="会员卡号/手机号" @keyup.enter="saoma" />
                </div>
                <div class="search"><el-button id="searchButton" type="primary" icon="el-icon-search" size="small" style="margin-top: 5px" @click="searchUser(userId)">搜索</el-button></div>
              </div>
              <!--联系人-->
              <div class="userCon user">
                <span>联系人</span>
                <div class="input"><el-input size="8" v-model="userName" placeholder="联系人姓名" clearable></el-input></div>
              </div>
              <!--联系电话-->
              <div class="userCon phone">
                <span>联系电话</span>
                <div class="input">
                  <!--<el-input size="8" v-model="userTel" placeholder="联系电话" clearable></el-input>-->
                  <input id="userTel" type="text" v-model="userTel" placeholder="联系电话" @blur="telBlur" />
                </div>
              </div>
              <!--订单类型-->
              <div class="userCon roomType">
                <span>订单类型</span>
                <div class="radios">
                  <div class="rad_div" style="margin-top: 5px">
                    <el-radio v-model="orderTypevalue" label="1" border size="mini" @change="otvChange">普通订单</el-radio>
                    <el-radio v-model="orderTypevalue" label="2" border size="mini" @change="otvChange">分时订单</el-radio>
                  </div>
                </div>
              </div>
              <!--开房类型-->
              <div class="userCon roomType">
                <span>开房类型</span>
                <div class="radios">
                  <div class="rad_div">
                    <el-radio v-model="roomTypevalue" label="1" border size="mini">全天房</el-radio>
                    <el-radio v-model="roomTypevalue" label="2" border size="mini" :disabled="isMembership">钟点房</el-radio>
                  </div>
                  <div class="rad_div">
                    <el-radio v-model="roomTypevalue" label="3" border size="mini" :disabled="isMembership">特殊房</el-radio>
                    <el-radio v-model="roomTypevalue" label="4" border size="mini" :disabled="isMembership">免费房</el-radio>
                  </div>
                </div>
              </div>
              <!--订单来源-->
              <div class="userCon roomType">
                <span>订单来源</span>
                <div class="radio_source">
                  <div class="rad_left">
                    <el-radio v-model="radio_source" label="1" border size="mini">前台</el-radio>
                    <el-radio v-model="radio_source" label="2" border size="mini" :disabled="isMembership || roomTypevalue == 3 || roomTypevalue ==4">电商</el-radio>
                    <el-radio v-model="radio_source" label="3" border size="mini" :disabled="isMembership">协议客户</el-radio>
                  </div>
                  <div class="rad_right" v-if="radio_source == 2">
                    <div class="rr_one">
                      <div class="rr_bottom">
                        <el-select id="orderSelect" v-model="radio_key" placeholder="选择电商平台">
                          <el-option
                            v-for="item in onlineRetailers"
                            :key="item.ota_id"
                            :label="item.ota_name"
                            :value="item.ota_id">
                          </el-option>
                        </el-select>
                      </div>
                      <div class="rr_top">
                        <el-input id="orderId" v-model="onlineRetailersId" placeholder="输入订单号" clearable></el-input>
                      </div>
                    </div>
                    <div class="rr_radios">
                      <el-radio size="mini" v-model="open_pay_type" label="1" border>预付</el-radio>
                      <el-radio size="mini" v-model="open_pay_type" label="2" border>到付</el-radio>
                    </div>
                  </div>
                  <div class="rad_right" v-if="radio_source == 3">
                    <el-autocomplete
                      class="inline-input"
                      v-model="state1"
                      :fetch-suggestions="querySearch"
                      placeholder="请输入协议客户"
                      @select="handleSelect"
                    ></el-autocomplete>
                  </div>
                </div>
              </div>
              <!--备注-->
              <div class="userCon user">
                <span>备注</span>
                <div class="input"><el-input size="20" v-model="remarksInfo" placeholder="请输入备注" clearable></el-input></div>
              </div>
            </div>
            <!--房价板块-->
            <div class="money" v-if="order_parameter.orderStatus == undefined">
              <el-table
                :data="order_parameter"
                style="width: 100%;">
                <el-table-column
                  label="房间"
                  width="88"
                  align="center">
                  <template slot-scope="scope">
                    <div style="height: 49%">{{scope.row.roomNo}}</div>
                    <div style="height: 49%">{{scope.row.roomName}}</div>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="showDate"
                  label="日期"
                  width="100">
                </el-table-column>
                <el-table-column width="100" label="房价">
                  <template slot-scope="item">
                    <div v-if="state1 == ''">
                      <div v-if="orderTypevalue == 1 && roomTypevalue == 1 || orderTypevalue == 1 && roomTypevalue == 3 || orderTypevalue == 1 && roomTypevalue == 4">
                        <el-input v-model="item.row.strike_price" placeholder="请输入价格" clearable @change="roomPrcieChange"></el-input>
                      </div>
                      <div v-if="orderTypevalue == 2 && roomTypevalue == 1 || orderTypevalue == 2 && roomTypevalue == 3 || orderTypevalue == 2 && roomTypevalue == 4">
                        <el-input v-model="item.row.member_price" placeholder="请输入价格" clearable @change="roomPrcieChange"></el-input>
                      </div>
                      <div v-if="roomTypevalue == 2">
                        <el-input v-model="item.row.hour_room_price" placeholder="请输入价格" clearable @change="roomPrcieChange"></el-input>
                      </div>
                    </div>
                    <div v-else>
                      <el-input v-model="item.row.agreement_price" placeholder="请输入价格" clearable @change="roomPrcieChange"></el-input>
                    </div>
                  </template>
                </el-table-column>
                <el-table-column label="操作">
                  <template slot-scope="scope">
                    <span v-if="scope.$index + 1 == order_parameter.length">
                      <el-button
                        size="mini"
                        type="danger"
                        @click="confirm1(scope.$index)">删除</el-button>
                    </span>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <div class="money" v-else>
              <el-table
                :data="order_parameter.order_parameter"
                style="width: 100%;">
                <el-table-column
                  label="房间"
                  width="88"
                  align="center">
                  <template slot-scope="scope">
                    <div style="height: 49%">{{scope.row.house_no}}</div>
                    <div style="height: 49%">{{scope.row.room_name}}</div>
                  </template>
                </el-table-column>
                <el-table-column
                  label="日期"
                  width="100"
                  align="center">
                  <template slot-scope="scope">
                    <div style="height: 49%">{{scope.row.lock_date.substring(5,scope.row.lock_date.length)}}</div>
                  </template>
                </el-table-column>
                <el-table-column width="100" label="房价">
                  <template slot-scope="item">
                    <div v-if="state1 == ''">
                      <div v-if="orderTypevalue == 1 && roomTypevalue == 1">
                        <el-input v-model="item.row.prices.strike_price" placeholder="请输入价格" clearable @change="roomPrcieChange"></el-input>
                      </div>
                      <div v-if="orderTypevalue == 2 && roomTypevalue == 1">
                        <el-input v-model="item.row.prices.member_price" placeholder="请输入价格" clearable @change="roomPrcieChange"></el-input>
                      </div>
                      <div v-if="roomTypevalue == 2">
                        <el-input v-model="item.row.prices.hour_room_price" placeholder="请输入价格" clearable @change="roomPrcieChange"></el-input>
                      </div>
                    </div>
                    <div v-else>
                      <el-input v-model="item.row.prices.agreement_price" placeholder="请输入价格" clearable @change="roomPrcieChange"></el-input>
                    </div>
                  </template>
                </el-table-column>
                <el-table-column label="操作">
                  <template slot-scope="scope">
                    <span v-if="scope.$index + 1 == order_parameter.order_parameter.length">
                      <el-button
                        size="mini"
                        type="danger"
                        @click="confirm1(scope.$index)">删除</el-button>
                    </span>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <!--收支详情-->
            <div class="confirmPayInfo" v-if="orderPayInfoList.length > 0">
              <div class="opTitle">
                <span>收支信息</span>
                <div>
                  <label>
                    <span>总收款：</span>
                    <span style="color: #ffb54a">￥{{recordRevenue_total}}</span>
                  </label>
                  <label>
                    <span>总消费：</span>
                    <span style="color: #ffb54a">￥{{recordRevenue_consumption}}</span>
                  </label>
                  <label v-if="recordRevenue_total <= recordRevenue_consumption">
                    <span>应收：</span>
                    <span style="color: #ffb54a">￥{{recordRevenue_receivables}}</span>
                  </label>
                  <label v-if="recordRevenue_total > recordRevenue_consumption">
                    <span>应退：</span>
                    <span style="color: #ffb54a">￥{{recordRevenue_receivables}}</span>
                  </label>
                </div>
              </div>
              <div class="orderPayInfoList">
                <div class="title">
                  <span>消费详情</span>
                  <label class="lab" :class="orderPayInfoListShow_1?'':'lab_unshow'" @click="showTab(1)"><i class="el-icon-arrow-down"></i></label>
                </div>
                <transition name="el-zoom-in-top">
                  <div v-show="orderPayInfoListShow_1">
                    <el-table
                      :data="orderPayInfoList_payType1"
                      border
                      style="width: 100%;font-size: 12px">
                      <el-table-column
                        prop="house_no"
                        label="房间号"
                        width="70"
                        align="center">
                      </el-table-column>
                      <el-table-column
                        prop="subject_name"
                        label="科目"
                        width="70"
                        align="center">
                      </el-table-column>
                      <el-table-column
                        prop="money"
                        label="金额"
                        width="70"
                        align="center">
                      </el-table-column>
                      <el-table-column
                        prop="showCreated_at"
                        label="消费时间"
                        width="150"
                        align="center">
                      </el-table-column>
                      <el-table-column label="操作" align="center">
                        <template slot-scope="scope">
                          <div class="paydetails" @click="payInfoDetail(scope.row)">详情</div>
                        </template>
                      </el-table-column>
                    </el-table>
                  </div>
                </transition>
                <div class="title" style="margin-top: 10px">
                  <span>收入详情</span>
                  <label class="lab" :class="orderPayInfoListShow_0?'':'lab_unshow'" @click="showTab(0)"><i class="el-icon-arrow-down"></i></label>
                </div>
                <transition name="el-zoom-in-top">
                  <div v-show="orderPayInfoListShow_0">
                    <el-table
                      :data="orderPayInfoList_payType0"
                      border
                      style="width: 100%;font-size: 12px">
                      <el-table-column
                        prop="account_name"
                        label="账户"
                        width="70"
                        align="center">
                      </el-table-column>
                      <el-table-column
                        prop="subject_name"
                        label="科目"
                        width="70"
                        align="center">
                      </el-table-column>
                      <el-table-column
                        prop="money"
                        label="金额"
                        width="70"
                        align="center">
                      </el-table-column>
                      <el-table-column
                        prop="showCreated_at"
                        label="时间"
                        width="150"
                        align="center">
                      </el-table-column>
                      <el-table-column
                        prop="pay_status"
                        label="状态"
                        width="70"
                        align="center">
                      </el-table-column>
                      <el-table-column label="操作" align="center">
                        <template slot-scope="scope">
                          <div class="paydetails" @click="payInfoDetail(scope.row)">详情</div>
                        </template>
                      </el-table-column>
                    </el-table>
                  </div>
                </transition>
                <div class="title" style="margin-top: 10px" v-if="integral_list.length > 0 && orderplate_info.orderType == '分时订单'">
                  <span>易用豆信息</span>
                </div>
                <div v-if="integral_list.length > 0 && orderplate_info.orderType == '分时订单'">
                  <el-table
                    :data="integral_list"
                    border
                    style="width: 100%;font-size: 12px">
                    <el-table-column
                      prop="house_no"
                      label="房间"
                      width="70"
                      align="center">
                    </el-table-column>
                    <el-table-column
                      prop="used_time"
                      label="入住时间"
                      width="100"
                      align="center">
                    </el-table-column>
                    <el-table-column
                      prop="rest_time"
                      label="剩余时间"
                      width="100"
                      align="center">
                    </el-table-column>
                    <el-table-column
                      prop="integral_time"
                      label="可存时间"
                      width="100"
                      align="center">
                    </el-table-column>
                    <el-table-column
                      prop="integral"
                      label="获得易用豆"
                      width="70"
                      align="center">
                    </el-table-column>
                    <el-table-column
                      prop="integral_status"
                      label="发放状态"
                      width="70"
                      align="center">
                    </el-table-column>
                  </el-table>
                </div>
              </div>
            </div>
            <!--收款资料-->
            <div class="receivables">
              <div class="isMembership" v-if="isMembership">
                <div class="rec_con account">
                  <span>账户易用豆：</span>
                  <span style="text-align: left">{{membershipIntegral}}</span>
                  <span style="margin-left: 10%">共需易用豆：</span>
                  <span style="text-align: left">{{openIntegral}}</span>
                  <span style="float: right">
                    <el-checkbox v-model="checkedIntegral" @change="integralChange">易用豆开房</el-checkbox>
                  </span>
                </div>
                <div class="rec_con account">
                  <span style="text-align: left" v-show="checkedIntegral">
                  <label style="color: #9ccc65" v-if="membershipIntegral >= openIntegral">可以开房</label>
                  <label style="color:#f56c6c;" v-else>易用豆余额不足</label>
                </span>
                </div>
              </div>
              <div class="rec_con account">
                <span>房费共计：</span>
                <label style="text-align: left" v-if="!isNaN(total)">￥{{total}}元</label>
                <label style="text-align: left" v-else>￥--元</label>
              </div>
            </div>
          </div>
          <!--按钮组-->
          <div class="button" v-if="order_parameter.orderStatus == undefined">
            <div class="buts">
              <el-button type="success" size="small" @click="confirmGetRoom(0)" :disabled="integralButton">确认</el-button>
              <el-button type="success" size="small" @click="confirmGetRoom(1)" :disabled="integralButton">保存订单</el-button>
              <el-button type="warning" size="small" @click="cancelOrder">取消</el-button>
            </div>
          </div>
          <div class="button" v-else>
            <div class="buts">
              <el-button type="success" size="small" @click="receivables2(1)">收款</el-button>
              <el-button type="success" size="small" @click="receivables2(2)">退款</el-button>
              <el-button type="success" size="small" @click="confirmGetRoomUpdate(1)" :disabled="integralButton">保存订单</el-button>
              <el-button type="success" size="small" @click="confirmGetRoomUpdate(0)" :disabled="integralButton">确认</el-button>
              <el-button type="warning" size="small" @click="cancelOrder">取消</el-button>
            </div>
          </div>
      </div>
    </div>
    <!--实时房态板块-->
    <div class="realTime" v-if="formCon[1]"></div>
    <!--订单详情板块-->
    <div class="orderplate" v-if="formCon[2]">
      <div class="title">订单详情 {{orderplate_info.order_No}}<i id="refreshOrder" class="el-icon-refresh" @click="refreshOrder"></i></div>
      <div class="lodingDiv" v-if="public_is_Loading">
        <div class="loginIcon">
          <img src="../../assets/loading.gif"/>
        </div>
        <div class="loginText">加载中，请稍后...</div>
      </div>
      <!--订单信息-->
      <div class="orderplateInfo">
        <div class="oi_row row1">
          <div class="oi_col_one">
            <div class="oi_col_title">订单状态</div>
            <div class="oi_col_content">{{orderplate_info.orderStatus}}</div>
          </div>
          <div class="oi_col_two">
            <div class="oi_col_title oi_col_title_agin">来源</div>
            <div class="oi_col_content" v-if="orderplate_info.orderSource != 0 && orderplate_info.orderSource != 3 && !orderplate_info.isWechat">
              <div class="coc_top">{{orderplate_info.otaName}}
                (
                  <span v-if="orderplate_info.ota_order_type != undefined">
                    <span v-if="orderplate_info.ota_order_type == 0">到付</span>
                    <span v-if="orderplate_info.ota_order_type == 1">预付</span>
                  </span>
                )
              </div>
              <div class="coc_bottom" v-if="orderplate_info.otaNo != '' && orderplate_info.otaNo != undefined">{{orderplate_info.otaNo}}</div>
            </div>
            <div class="oi_col_content" v-if="orderplate_info.orderSource == 0 && !orderplate_info.isWechat">
              <div class="coc_top" style="line-height: 40px">前台</div>
            </div>
            <div class="oi_col_content" v-if="orderplate_info.orderSource == 3 && !orderplate_info.isWechat">
              <div class="coc_top" style="line-height: 40px">{{orderplate_info.otaName}}</div>
            </div>
            <div class="oi_col_content" v-if="orderplate_info.isWechat">
              <div class="coc_top" style="line-height: 40px">{{orderplate_info.otaName}}</div>
            </div>
          </div>
        </div>
        <div class="oi_row row2">
          <div class="oi_col_one">
            <div class="oi_col_title">预订人</div>
            <div class="oi_col_content">{{orderplate_info.orderPeopleName}}</div>
          </div>
          <div class="oi_col_two">
            <div class="oi_col_title oi_col_title_agin">手机号</div>
            <div class="oi_col_content">{{orderplate_info.orderPeopleTel}}</div>
          </div>
        </div>
        <div class="oi_row row3">
          <div class="oi_col_one">
            <div class="oi_col_title">创建人</div>
            <div class="oi_col_content">{{orderplate_info.orderCreatedName}}</div>
          </div>
          <div class="oi_col_two">
            <div class="oi_col_title oi_col_title_agin">创建时间</div>
            <div class="oi_col_content">{{orderplate_info.orderCreatedTime}}</div>
          </div>
        </div>
        <div class="oi_row row4">
          <div class="oi_col_one">
            <div class="oi_col_title">订单类型</div>
            <div class="oi_col_content">{{orderplate_info.orderType}}</div>
          </div>
          <div class="oi_col_two">
            <div class="oi_col_title oi_col_title_agin">开房类型</div>
            <div class="oi_col_content">{{orderplate_info.orderRoomTypevalue}}</div>
          </div>
        </div>
        <div class="oi_row row5">
          <div class="oi_col_only">
            <div class="oi_col_title">内部备注</div>
            <div class="oi_col_content">{{orderplate_info.orderRemarks}}</div>
          </div>
        </div>
      </div>
      <!--房间信息-->
      <div class="orderplate_tab">
        <el-table
          :data="orderplate_info.order_parameter"
          border
          style="width: 100%;font-size: 12px">
          <el-table-column
            label="房间"
            align="center">
            <template slot-scope="scope">
              <div style="height: 49%">{{scope.row.house_no}}</div>
              <div style="height: 49%">{{scope.row.room_name}}</div>
            </template>
          </el-table-column>
          <el-table-column
            label="日期"
            width="180"
            align="center">
            <template slot-scope="scope">
              <div style="height: 49%" v-if="scope.row.order_house_status == '未入住' || scope.row.order_house_status == '预定中'">预住:{{scope.row.showExcept_check_in_at}}</div>
              <div style="height: 49%" v-if="scope.row.order_house_status == '已入住' || scope.row.order_house_status == '已退房'">实住:{{scope.row.check_in_at}}</div>
              <div style="height: 49%" v-if="scope.row.order_house_status != '已退房'">预离:{{scope.row.showExcept_check_out_at}}</div>
              <div style="height: 49%" v-if="scope.row.order_house_status == '已退房'">实离:{{scope.row.showcheck_out_at}}</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="order_house_status"
            label="房间状态"
            width="80"
            align="center">
          </el-table-column>
          <el-table-column label="操作" align="center" width="120">
            <template slot-scope="scope">
              <div v-if="scope.row.order_house_status == '未入住' || scope.row.order_house_status == '预定中' || scope.row.order_house_status == 'NoShow' ">
                <el-select size="mini" v-model="roomdetailsList_1_val[scope.$index]" placeholder="操作">
                  <el-option
                    v-for="(item,ind) in roomdetailsList_1[0]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                    <div @click="check_in(scope.row.house_no,scope.row.room_name,scope.row.id)" v-if="item.value == 1">{{item.label }}</div>
                    <div @click="continuedRoom(scope.row.house_no,scope.row.room_name,scope.row.id)" v-if="item.value == 2">{{item.label }}</div>
                    <div @click="exchangHouses(scope.row.id)" v-if="item.value == 3">{{item.label }}</div>
                    <div @click="checkOut(scope.row.house_no,scope.row.room_name,scope.row.id)" v-if="item.value == 4">{{item.label }}</div>
                    <div @click="cancelRoom(scope.row.house_no,scope.row.room_name,scope.row.id)" v-if="item.value == 5">{{item.label }}</div>
                    <div @click="houseDetails(scope.row.house_no,scope.row.room_name,scope.row.id)" v-if="item.value == 6">{{item.label }}</div>
                  </el-option>
                </el-select>
              </div>
              <div v-if="scope.row.order_house_status == '已入住'">
                <el-select size="mini" v-model="roomdetailsList_2_val[scope.$index]" placeholder="操作">
                  <el-option
                    v-for="item in roomdetailsList_2[0]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                    <div @click="check_search(scope.row.house_no,scope.row.room_name,scope.row.id)" v-if="item.value == 1">{{ item.label }}</div>
                    <div @click="continuedRoom(scope.row.house_no,scope.row.room_name,scope.row.id)" v-if="item.value == 2">{{ item.label }}</div>
                    <div @click="exchangHouses(scope.row.id)" v-if="item.value == 3">{{ item.label }}</div>
                    <div @click="checkOut(scope.row.house_no,scope.row.room_name,scope.row.id)" v-if="item.value == 4">{{ item.label }}</div>
                    <div @click="houseDetails(scope.row.house_no,scope.row.room_name,scope.row.id)" v-if="item.value == 6">{{item.label }}</div>
                  </el-option>
                </el-select>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!--付款信息-->
      <div class="orderPayInfo" v-if="orderPayInfoList.length > 0">
        <div class="opTitle">
          <span>收支信息</span>
          <div>
            <label>
              <span>总收款：</span>
              <span style="color: #ffb54a">￥{{parseFloat(recordRevenue_total)}}</span>
            </label>
            <label>
              <span>总消费：</span>
              <span style="color: #ffb54a">￥{{parseFloat(recordRevenue_consumption)}}</span>
            </label>
            <label v-if="parseFloat(recordRevenue_total) <= parseFloat(recordRevenue_consumption)">
              <span>应收：</span>
              <span style="color: #ffb54a">￥{{parseFloat(recordRevenue_receivables)}}</span>
            </label>
            <label v-if="parseFloat(recordRevenue_total) > parseFloat(recordRevenue_consumption)">
              <span>应退：</span>
              <span style="color: #ffb54a">￥{{parseFloat(recordRevenue_receivables)}}</span>
            </label>
          </div>
        </div>
        <div class="orderPayInfoList">
          <div class="title">
            <span>消费详情</span>
            <span class="printButton" @click="printClick(orderplate_info.order_id)">打印明细</span>
            <label class="lab" :class="orderPayInfoListShow_1?'':'lab_unshow'" @click="showTab(1)"><i class="el-icon-arrow-down"></i></label>
          </div>
          <transition name="el-zoom-in-top">
            <div v-show="orderPayInfoListShow_1">
              <el-table
                :data="orderPayInfoList_payType1"
                border
                style="width: 100%;font-size: 12px;">
                <el-table-column
                  prop="house_no"
                  label="房间号"
                  align="center">
                </el-table-column>
                <el-table-column
                  prop="subject_name"
                  label="科目"
                  width="110"
                  align="center">
                </el-table-column>
                <el-table-column label="金额" width="70" align="center">
                  <template slot-scope="scope">
                    <span v-if="scope.row.pay_direction == 1">-</span>
                    <span>{{scope.row.money}}</span>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="showCreated_at"
                  label="消费时间"
                  width="140"
                  align="center">
                </el-table-column>
                <el-table-column label="操作" align="center" width="120">
                  <template slot-scope="scope">
                    <div class="paydetails" @click="payInfoDetail(scope.row)">详情</div>
                    <div v-if="scope.row.pay_direction != 1 && orderplate_info.orderStatus != '已完成'">
                      <div v-if="scope.row.subject_id != 1">
                        <div class="paydetails" style="margin-top: 5px" @click="flushing(scope.row)" v-if="parseFloat(scope.row.money) - parseFloat(scope.row.refund_money)">冲调</div>
                      </div>
                      <div v-else>
                        <div v-if="scope.row.is_share_time != 1">
                          <div class="paydetails" style="margin-top: 5px" @click="flushing(scope.row)" v-if="parseFloat(scope.row.money) - parseFloat(scope.row.refund_money)">冲调</div>
                        </div>
                        <div v-else>
                          <div class="paydetails" style="margin-top: 5px" @click="flushing(scope.row)" v-if="parseFloat(scope.row.money) - parseFloat(scope.row.refund_money) && orderplate_info.orderStatus == '已取消'">冲调</div>
                        </div>
                      </div>
                    </div>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </transition>
          <div class="title" style="margin-top: 10px">
            <span>收入详情</span>
            <label class="lab" :class="orderPayInfoListShow_0?'':'lab_unshow'" @click="showTab(0)"><i class="el-icon-arrow-down"></i></label>
          </div>
          <transition name="el-zoom-in-top">
            <div v-show="orderPayInfoListShow_0">
              <el-table
                :data="orderPayInfoList_payType0"
                border
                style="width: 100%;font-size: 12px">
                <el-table-column
                  prop="account_name"
                  label="账户"
                  width="70"
                  align="center">
                </el-table-column>
                <el-table-column
                  prop="subject_name"
                  label="科目"
                  width="50"
                  align="center">
                </el-table-column>
                <el-table-column label="金额" width="80" align="center">
                  <template slot-scope="scope">
                    <span v-html="scope.row.pay_direction == 0?'+':'-'"></span>
                    <span>{{scope.row.money}}</span>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="showCreated_at"
                  label="时间"
                  width="110"
                  align="center">
                </el-table-column>
                <el-table-column label="状态" align="center" width="80">
                  <template slot-scope="scope">
                    <div class="payMentsStatus">
                      <!--微信退款，状态单独判断-->
                      <div v-if="scope.row.account_id == 2 && scope.row.subject_id == 4 && scope.row.third_pay_status == 0">待微信处理</div>
                      <div v-if="scope.row.account_id == 2 && scope.row.subject_id == 4 && scope.row.third_pay_status == 1">微信处理中</div>
                      <div v-if="scope.row.account_id == 2 && scope.row.subject_id == 4 && scope.row.third_pay_status == 2">已退款</div>
                      <div v-if="scope.row.account_id == 2 && scope.row.subject_id == 4 && scope.row.third_pay_status == 3">微信处理失败</div>
                      <div v-if="scope.row.account_id == 2 && scope.row.subject_id != 4">{{scope.row.pay_status}}</div>
                      <div v-if="scope.row.account_id != 2">{{scope.row.pay_status}}</div>
                      <div class="refresh" v-if="scope.row.pay_status == '退款中' || scope.row.pay_status == '支付中' && scope.row.account_id == 2"><i class="refreshPayMents el-icon-refresh" @click="refreshPaying(scope.row)"></i></div>
                    </div>
                  </template>
                </el-table-column>
                <el-table-column label="操作" align="center">
                  <template slot-scope="scope">
                    <div class="paydetails" @click="payInfoDetail(scope.row)">详情</div>
                    <!--<div v-if="orderplate_info.orderStatus != '已完成'">-->
                      <!--<div class="paydetails refund" @click="payInfoRefund(scope.row)" v-if="scope.row.money > scope.row.refund_money && scope.row.account_id == 2 && scope.row.pay_status == '已支付' && scope.row.pay_direction == 0">退款</div>-->
                    <!--</div>-->
                    <!--<div class="paydetails refund" @click="cancelPay(scope.row)" v-if="scope.row.pay_status == '支付中'">取消</div>-->
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </transition>
          <div class="title" style="margin-top: 10px" v-if="integral_list.length > 0 && orderplate_info.orderType == '分时订单'">
            <span>易用豆信息</span>
          </div>
          <div v-if="integral_list.length > 0 && orderplate_info.orderType == '分时订单'">
            <el-table
              :data="integral_list"
              border
              style="width: 100%;font-size: 12px">
              <el-table-column
                prop="house_no"
                label="房间"
                width="70"
                align="center">
              </el-table-column>
              <el-table-column
                prop="used_time"
                label="入住时间"
                width="100"
                align="center">
              </el-table-column>
              <el-table-column
                prop="rest_time"
                label="剩余时间"
                width="100"
                align="center">
              </el-table-column>
              <el-table-column
                prop="integral_time"
                label="可存时间"
                width="100"
                align="center">
              </el-table-column>
              <el-table-column
                prop="integral"
                label="获得易用豆"
                width="70"
                align="center">
              </el-table-column>
              <el-table-column
                prop="integral_status"
                label="发放状态"
                width="70"
                align="center">
              </el-table-column>
            </el-table>
          </div>
        </div>
      </div>
      <div class="buttons" v-if="orderplate_info.orderStatus != '已完成' && !orderplate_info.isWechat">
        <el-button type="success" size="mini" @click="receivables(0)">押金</el-button>
        <el-button type="success" size="mini" @click="receivables(1)">消费</el-button>
        <el-button type="success" size="mini" @click="receivables(2)">收款</el-button>
        <el-button type="success" size="mini" @click="receivables(3)">退款</el-button>
        <el-button type="success" size="mini" @click="receivables(4)" :disabled="canCheckOut">结账</el-button>
      </div>
      <div class="buttons" v-if="orderplate_info.orderStatus != '未确认' && orderplate_info.orderStatus != '已完成' && orderplate_info.isWechat && orderplate_info.pay_status == 2">
        <el-button type="success" size="mini" @click="receivables(0)">押金</el-button>
        <el-button type="success" size="mini" @click="receivables(1)">消费</el-button>
        <el-button type="success" size="mini" @click="receivables(2)">收款</el-button>
        <el-button type="success" size="mini" @click="receivables(3)">退款</el-button>
        <el-button type="success" size="mini" @click="receivables(4)" :disabled="canCheckOut">结账</el-button>
      </div>
      <div class="buttons" v-if="orderplate_info.orderStatus == '未确认' && !orderplate_info.isWechat">
        <el-button type="success" size="mini" @click="confirmButton(true)">确认</el-button>
        <el-button type="success" size="mini" @click="confirmButton(false)">取消</el-button>
      </div>
      <div class="buttons" v-if="orderplate_info.orderStatus == '未确认' && orderplate_info.isWechat && orderplate_info.pay_status == 2">
        <el-button type="success" size="mini" @click="confirmWeChat()">确认</el-button>
      </div>
      <div class="buttons" v-if="orderplate_info.orderStatus == '已完成'">
        <el-button type="success" size="mini" @click="reconciliation(orderplate_info.bill_status)">平台对账<span v-if="orderplate_info.bill_status == 1">信息</span></el-button>
      </div>
      <div class="text" v-if="orderplate_info.orderStatus == '已完成'" style="font-size: 14px;
        color: #A6A6A6;
        text-align: center;
        margin-bottom: 15px;
        margin-top: -10px">订单完成后一小时内不人工对账系统将自动确认</div>
    </div>
  </div>
</template>

<script>
  import { MessageBox } from 'element-ui';
  import {mapGetters,mapActions} from 'vuex'
    export default {
      props:['box_type','toParameter'],
      name: "box-content",
      computed:mapGetters([
        'payInfo',
        'public_is_Loading',
        'otaList',
        'saveHouseList',
        'agreement_customers',
        'agreement_projects',
        'oldList',
        'canRefresh'
      ]),
      components: {
        MessageBox,
      },
      data() {
          return {
            tab:true,
            formCon:[false,false,false], //板块参数
            order_parameter:[],
            userId:'', //会员卡号
            is_activate:true, //是否为激活会员
            isMember:false,
            userCode:'', //会员编号
            userName:'', //会员姓名
            userTel:'', //会员手机号
            roomTypevalue:'1', //选择的开房类型
            orderTypevalue:'1', //订单类型 1：普通订单 2：分时订单
            roomTime:'', //开房时间
            roomList:[], //房价列表
            accountValue:'', //收款账户
            total:0, //总房费
            needIntegral:0, //
            isMembership:false, //是否选择分时订单
            membershipIntegral:0, //分时会员现有易用豆
            openIntegral:0, //开房所需易用豆（总房价乘以100）
            checkedIntegral:false, //是否使用易用豆开房
            integralButton:false, //使用易用豆情况下，是否可以开房
            radio_from:'1', //订单来源单选框
            confirmRoomList:[], //确认房间列表
            radio_source:'1', //订单来源单选框
            radio_key:'', //电商订单来源下拉列表值
            onlineRetailersId:'', //电商单的订单ID
            open_pay_type:'1', //预付或到付的单选框
            roomdetailsList_1:[], //订单确认页面，房间操作列表(待入住状态下)
            roomdetailsList_2:[], //订单确认页面，房间操作列表(已入住状态下)
            roomdetailsList_1_val:'', //订单确认页面，房间操作列表(待入住状态下的值)
            roomdetailsList_2_val:'', //订单确认页面，房间操作列表(待入住状态下的值)
            onlineRetailers:[], //电商平台列表
            remarksInfo:'', //备注信息
            orderplate_info:[], //订单详情内容容器
            visible2:false,
            orderPayInfoList:[], //支付记录列表
            orderPayInfoList_payType0:[], //收入列表
            orderPayInfoList_payType1:[], //消费列表
            recordRevenue_total:0, //收支总收款
            recordRevenue_consumption:0, //收支总消费
            recordRevenue_receivables:0, //收支余额
            orderDeposit:0, //订单详情押金
            orderPayInfoListShow_0:true, //收入详情是否显示
            orderPayInfoListShow_1:true, //消费详情是否显示
            canCheckOut:false, //是否可以结账
            integral_list:[], //易用豆信息列表
            order_parameter_roomList:[], //预订房间的房间列表
            /*协议客户*/
            project_id:0, //协议客户ID
            protocolCustomer:[], //协议客户列表
            state1: '', //选择的协议客户
          }
      },
      watch: {
        //监听页面传来的参数是否变化
        toParameter(val){
          let self = this
          if (self.box_type == 1){ //来自于开房页面
            if (val.orderStatus == undefined){
              let newArr2 = []
              for (let i = 0;i < val.length; i++){
                newArr2.push({
                  agreement_price:val[i].agreement_price
                })
              }
              self.upstate({key:'oldList',val:newArr2})
              self.from_1 = val
              let oneDay = 86400000
              let newArr = []
              for (let i = 0; i < val.nightNum; i++){
                newArr.push({
                  date:self.timestampToTime(val.createTime + oneDay * i),
                  price:167 + i,
                  roomName:self.from_1.roomName,
                  roomNo:self.from_1.roomNo,
                  roomStatus:self.from_1.roomStatus
                })
              }
              self.roomList = newArr
              //计算总房费
              let num = 0
              for (let i = 0; i < val.length; i++){
                num += parseFloat(val[i].price)
              }
              self.total = num
              self.openIntegral = self.total
            }else {
              self.order_parameter = val
              self.userId = self.order_parameter.orderPeopleId
              self.userName = self.order_parameter.orderPeopleName
              self.userTel = self.order_parameter.orderPeopleTel
              if (self.order_parameter.orderType == 0){
                self.orderTypevalue = '1'
              }else {
                self.orderTypevalue = '2'
              }
              //开房类型 0:全日房 1:钟点房 2:免费房 3:特殊房
              if (self.order_parameter.orderRoomTypevalue == 0){
                self.roomTypevalue = '1'
              }else if (self.order_parameter.orderRoomTypevalue == 1){
                self.roomTypevalue = '2'
              }else if (self.order_parameter.orderRoomTypevalue == 2){
                self.roomTypevalue = '3'
              }else if (self.order_parameter.orderRoomTypevalue == 3){
                self.roomTypevalue = '4'
              }
              if (self.order_parameter.orderSource == 0){
                self.radio_source = '1'
              }else if (self.order_parameter.orderSource == 2){
                self.radio_source = '2'
              }else if (self.order_parameter.orderSource == 3){
                self.radio_source = '3'
              }
              self.remarksInfo = self.order_parameter.orderRemarks
              let newArr = []
              for (let i = 0; i < self.order_parameter.order_parameter.length; i++){
                newArr.push({
                  date:self.order_parameter.order_parameter[i].lock_date,
                  hour_room_price:self.order_parameter.order_parameter[i].prices.hour_room_price,
                  member_price:self.order_parameter.order_parameter[i].prices.member_price,
                  agreement_price:self.order_parameter.order_parameter[i].prices.agreement_price,
                  strike_price:self.order_parameter.order_parameter[i].prices.strike_price,
                  roomId:self.order_parameter.order_parameter[i].id,
                  roomName:self.order_parameter.order_parameter[i].room_name,
                  roomNo:self.order_parameter.order_parameter[i].house_no,
                  showDate:self.order_parameter.order_parameter[i].lock_date.substring(5,self.order_parameter.order_parameter[i].lock_date.length),
                })
              }
              self.order_parameter_roomList = newArr
              self.upstate({key:'payInfo',val:self.order_parameter.payments})
            }
          }else if (self.box_type == 3){ //来自订单详情页面
            self.upstate({key:'public_is_Loading',val:false}) //加载中消失
            self.orderplate_info = self.toParameter
            if (self.orderplate_info.payCount != undefined){
              //总收款数据刷新
              self.recordRevenue_total = parseFloat(self.orderplate_info.payCount.total_paid)
              //总消费数据刷新
              self.recordRevenue_consumption = parseFloat(self.orderplate_info.payCount.total_consumed)
              //余额数据刷新
              self.recordRevenue_consumption = self.orderplate_info.payCount.total_consumed
              if (self.recordRevenue_total <= self.recordRevenue_consumption){ //应收
                self.recordRevenue_receivables = Math.abs(parseFloat(self.orderplate_info.payCount.total_balance))
              }else { //应退
                self.recordRevenue_receivables = Math.abs(parseFloat(self.orderplate_info.payCount.total_balance))
              }
            }
            // 订单状态： 0=未确认，1=已确认，2=已取消，3=已完成，4=已结算
            if (self.orderplate_info.orderStatus == 0){
              self.orderplate_info.orderStatus = '未确认'
            }else if (self.orderplate_info.orderStatus == 1){
              self.orderplate_info.orderStatus = '已确认'
            }else if (self.orderplate_info.orderStatus == 2){
              self.orderplate_info.orderStatus = '已取消'
            }else if (self.orderplate_info.orderStatus == 3){
              self.orderplate_info.orderStatus = '已完成'
            }else if (self.orderplate_info.orderStatus == 4){
              self.orderplate_info.orderStatus = '已结算'
            }
            //订单类型： 0：普通订单 1：分时订单
            if (self.orderplate_info.orderType == 0){
              self.orderplate_info.orderType = '普通订单'
            }else if (self.orderplate_info.orderType == 1){
              self.orderplate_info.orderType = '分时订单'
            }
            if (self.orderplate_info.order_parameter != undefined){
              //房间状态 0=锁定中，1=未入住，2=已入住，3=退房中,5=已退房，6=已续房，7=已取消
              let newArr = []
              let caozuo1 = []
              let val1 = []
              let caozuo2 = []
              let val2 = []
              for (let i = 0; i < self.orderplate_info.order_parameter.length; i++){
                let showChekIn = false
                let check_in_time = new Date(self.orderplate_info.order_parameter[i].expect_check_in_at.substring(0,10) + ' 00:00:00').getTime()
                let date = new Date();
                let Y = date.getFullYear() + '-';
                let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
                let D = date.getDate() + ' ';
                let today = new Date(Y + M + D + ' 00:00:00').getTime()
                if (check_in_time - today >= 86400000){ //入住时间距离现在大于24小时
                  showChekIn = false
                }else {
                  showChekIn = true
                }
                self.orderplate_info.order_parameter[i].showExcept_check_in_at = self.orderplate_info.order_parameter[i].expect_check_in_at.substring(5,self.orderplate_info.order_parameter[i].expect_check_in_at.length)
                self.orderplate_info.order_parameter[i].showExcept_check_out_at = self.orderplate_info.order_parameter[i].expect_check_out_at.substring(5,self.orderplate_info.order_parameter[i].expect_check_out_at.length)
                if (self.orderplate_info.order_parameter[i].check_out_at != null){
                  self.orderplate_info.order_parameter[i].showcheck_out_at = self.orderplate_info.order_parameter[i].check_out_at.substring(5,self.orderplate_info.order_parameter[i].check_out_at.length)
                }
                let status = self.orderplate_info.order_parameter[i].order_house_status
                if (status == 0){
                  self.orderplate_info.order_parameter[i].order_house_status = '预定中'
                  self.canCheckOut = true
                  if (self.orderplate_info.isWechat){
                    caozuo1.push([{
                      value:3,
                      label:'换房'
                    },{
                      value:6,
                      label:'详情'
                    }])
                  }else {
                    if (showChekIn){
                      caozuo1.push([{
                        value:1,
                        label:'入住登记'
                      },{
                        value:2,
                        label:'续房'
                      },{
                        value:3,
                        label:'换房'
                      },{
                        value:5,
                        label:'取消'
                      },{
                        value:6,
                        label:'详情'
                      }])
                    }else {
                      caozuo1.push([{
                        value:2,
                        label:'续房'
                      },{
                        value:3,
                        label:'换房'
                      },{
                        value:5,
                        label:'取消'
                      },{
                        value:6,
                        label:'详情'
                      }])
                    }
                  }
                  val1.push('')
                }else if (status == 1){
                  self.orderplate_info.order_parameter[i].order_house_status = '未入住'
                  self.canCheckOut = true
                  if (showChekIn){
                    caozuo1.push([{
                      value:1,
                      label:'入住登记'
                    },{
                      value:2,
                      label:'续房'
                    },{
                      value:3,
                      label:'换房'
                    },{
                      value:5,
                      label:'取消'
                    },{
                      value:6,
                      label:'详情'
                    }])
                  }else {
                    caozuo1.push([{
                      value:2,
                      label:'续房'
                    },{
                      value:3,
                      label:'换房'
                    },{
                      value:5,
                      label:'取消'
                    },{
                      value:6,
                      label:'详情'
                    }])
                  }
                  val1.push('')
                }else if (status == 2){
                  self.orderplate_info.order_parameter[i].order_house_status = '已入住'
                  self.orderplate_info.order_parameter[i].check_in_at = self.orderplate_info.order_parameter[i].check_in_at.substring(5,self.orderplate_info.order_parameter[i].expect_check_in_at.length)
                  self.canCheckOut = true
                  caozuo2.push([{
                    value:1,
                    label:'入住信息'
                  },{
                    value:2,
                    label:'续房'
                  },{
                    value:3,
                    label:'换房'
                  },{
                    value:4,
                    label:'退房'
                  },{
                    value:6,
                    label:'详情'
                  }])
                  val2.push('')
                }else if (status == 3){
                  self.orderplate_info.order_parameter[i].order_house_status = '已退房'
                  self.canCheckOut = false
                  let status = ''
                  if (self.orderplate_info.order_parameter[i].integral_status == 0){
                    status = '待生成'
                  }else if (self.orderplate_info.order_parameter[i].integral_status == 1){
                    status = '待结算'
                  }else {
                    status = '已结算'
                  }
                  newArr.push({
                    house_no:self.orderplate_info.order_parameter[i].house_no,
                    used_time:self.orderplate_info.order_parameter[i].used_time,
                    rest_time:self.orderplate_info.order_parameter[i].rest_time,
                    integral_time:self.orderplate_info.order_parameter[i].integral_time,
                    integral:self.orderplate_info.order_parameter[i].integral,
                    integral_status:status,
                  })
                }else if (status == 4){
                  self.orderplate_info.order_parameter[i].order_house_status = '已取消'
                  self.canCheckOut = false
                }else if (status == 5){
                  self.orderplate_info.order_parameter[i].order_house_status = 'NoShow'
                  self.canCheckOut = false
                    caozuo1.push([{
                      value:6,
                      label:'详情'
                    }])
                  val1.push('')
                }
              }
              self.integral_list = newArr
              self.roomdetailsList_1 = caozuo1
              self.roomdetailsList_2 = caozuo2
              self.roomdetailsList_1_val = val1
              self.roomdetailsList_2_val = val2
              if (self.orderplate_info.orderRoomTypevalue == 0){
                self.orderplate_info.orderRoomTypevalue = '全日房'
              }else if (self.orderplate_info.orderRoomTypevalue == 1){
                self.orderplate_info.orderRoomTypevalue = '钟点房'
              }else if (self.orderplate_info.orderRoomTypevalue == 2){
                self.orderplate_info.orderRoomTypevalue = '免费房'
              }else if (self.orderplate_info.orderRoomTypevalue == 3){
                self.orderplate_info.orderRoomTypevalue = '特殊房'
              }
            }
          }
        },
        //监听支付记录是否变化
        payInfo(val){
          let self = this
          self.orderPayInfoList = val
          let newArr0 = []
          let newArr1 = []
          //0=待支付 1=支付中 2=已支付 3=失败
          for (let i = 0; i < self.orderPayInfoList.length; i++){
            if (self.orderPayInfoList[i].pay_type == 0){
              self.orderPayInfoList[i].showCreated_at = self.orderPayInfoList[i].created_at.substring(5,self.orderPayInfoList[i].created_at.length)
              newArr0.push(self.orderPayInfoList[i])
              if (self.orderPayInfoList[i].pay_status == 0){
                self.orderPayInfoList[i].pay_status = '待支付'
              }else if (self.orderPayInfoList[i].pay_status == 1 && self.orderPayInfoList[i].pay_direction == 0){
                self.orderPayInfoList[i].pay_status = '支付中'
              }else if (self.orderPayInfoList[i].pay_status == 1 && self.orderPayInfoList[i].pay_direction == 1){
                self.orderPayInfoList[i].pay_status = '退款中'
              }else if (self.orderPayInfoList[i].pay_status == 2 && self.orderPayInfoList[i].pay_direction == 0){
                self.orderPayInfoList[i].pay_status = '已支付'
              }else if (self.orderPayInfoList[i].pay_status == 2 && self.orderPayInfoList[i].pay_direction == 1){
                self.orderPayInfoList[i].pay_status = '已退款'
              }else if (self.orderPayInfoList[i].pay_status == 3){
                self.orderPayInfoList[i].pay_status = '失败'
              }
            }else {
              if (self.orderPayInfoList[i].receive_at != undefined && self.orderPayInfoList[i].receive_at != null){
                self.orderPayInfoList[i].showCreated_at = self.orderPayInfoList[i].receive_at.substring(5,self.orderPayInfoList[i].receive_at.length)
              }else {
                self.orderPayInfoList[i].showCreated_at = ''
              }
              if (self.orderPayInfoList[i].subject_id == 1){
                self.orderPayInfoList[i].subject_name += '(' + self.orderPayInfoList[i].effected_at.substring(5,self.orderPayInfoList[i].effected_at.length) + ')'
              }else if (self.orderPayInfoList[i].subject_id == 5){
                self.orderPayInfoList[i].subject_name += '(' + self.orderPayInfoList[i].name + ')'
              }
              newArr1.push(self.orderPayInfoList[i])
              self.orderPayInfoList[i].pay_status = ''
            }
          }
          self.orderPayInfoList_payType0 = newArr0
          self.orderPayInfoList_payType1 = newArr1
        },
        //监听预定订单数据变化
        order_parameter(val){
          let self = this
          if (val.order_parameter != undefined){
            //房费填充
            for (let i = 0;i < val.order_parameter.length; i++){
              if (self.orderTypevalue == 1){ //普通订单
                val.order_parameter[i].prices.strike_price = val.order_parameter[i].prices.lock_price
                if (self.roomTypevalue == 2) { //钟点房
                  val.order_parameter[i].prices.hour_room_price = val.order_parameter[i].prices.lock_price
                }
              }else { //分时订单
                val.order_parameter[i].prices.member_price = val.order_parameter[i].prices.lock_price
              }
            }
            //预定订单ota_id不为空时，填充OTA来源
            if (val.ota_id != null){
              let otaList = JSON.parse(localStorage.getItem('otaList'))
              for (let i = 0; i < otaList.length; i++){
                if (val.ota_id == otaList[i].ota_id){
                  self.radio_key = otaList[i].ota_id
                  self.onlineRetailersId = val.otaNo
                }
              }
            }
            //收支详情填充
            if (val.payments.length > 0){
              self.orderPayInfoList = val.payments
              let newArr0 = []
              let newArr1 = []
              //0=待支付 1=支付中 2=已支付 3=失败
              for (let i = 0; i < self.orderPayInfoList.length; i++){
                self.orderPayInfoList[i].showCreated_at = self.orderPayInfoList[i].created_at.substring(5,self.orderPayInfoList[i].created_at.length)
                if (self.orderPayInfoList[i].pay_type == 0){
                  newArr0.push(self.orderPayInfoList[i])
                  if (self.orderPayInfoList[i].pay_status == 0){
                    self.orderPayInfoList[i].pay_status = '待支付'
                  }else if (self.orderPayInfoList[i].pay_status == 1){
                    self.orderPayInfoList[i].pay_status = '支付中'
                  }else if (self.orderPayInfoList[i].pay_status == 2){
                    self.orderPayInfoList[i].pay_status = '已支付'
                  }else if (self.orderPayInfoList[i].pay_status == 3){
                    self.orderPayInfoList[i].pay_status = '失败'
                  }
                }else {
                  if (self.orderPayInfoList[i].subject_id == 1){
                    self.orderPayInfoList[i].subject_name += '(' + self.orderPayInfoList[i].effected_at.substring(5,self.orderPayInfoList[i].effected_at.length) + ')'
                  }else if (self.orderPayInfoList[i].subject_id == 5){
                    self.orderPayInfoList[i].subject_name += '(' + self.orderPayInfoList[i].name + ')'
                  }
                  newArr1.push(self.orderPayInfoList[i])
                  self.orderPayInfoList[i].pay_status = ''
                }
              }
              self.orderPayInfoList_payType0 = newArr0
              self.orderPayInfoList_payType1 = newArr1
            }

            //总收款数据刷新
            self.recordRevenue_total = parseFloat(val.payCount.total_paid)
            //总消费数据刷新
            self.recordRevenue_consumption = parseFloat(val.payCount.total_consumed)
            //余额数据刷新
            self.recordRevenue_consumption = val.payCount.total_consumed
            if (self.recordRevenue_total <= self.recordRevenue_consumption){ //应收
              self.recordRevenue_receivables = Math.abs(parseFloat(val.payCount.total_balance))
            }else { //应退
              self.recordRevenue_receivables = Math.abs(parseFloat(val.payCount.total_balance))
            }
            //总房价计算
            if (self.orderTypevalue == 1){ //普通订单
              if (self.roomTypevalue == 2){ //钟点房
                //计算总房费
                let num = 0
                for (let i = 0; i < val.order_parameter.length; i++){
                  num += parseFloat(val.order_parameter[i].prices.hour_room_price)
                }
                self.total = num
                self.openIntegral = self.total
              }else {
                //计算总房费
                let num = 0
                for (let i = 0; i < val.order_parameter.length; i++){
                  num += parseFloat(val.order_parameter[i].prices.strike_price)
                }
                self.total = num
                self.openIntegral = self.total
              }
            }else { //分时订单
              //计算总房费
              let num = 0
              for (let i = 0; i < val.order_parameter.length; i++){
                num += parseFloat(val.order_parameter[i].prices.member_price)
              }
              self.total = num
              self.openIntegral = self.total
              self.isMembership = true
              self.membershipIntegral = val.userInfo.bonus
            }
          }
        },
        //监听订单类型变化
        orderTypevalue(val){
          let self = this
          self.roomPrcieChange()
        },
        //监听开房类型变化
        roomTypevalue(val){
          let self = this
          self.roomPrcieChange()
        },
        //监听联系电话输入框
        userTel(val){
          let self = this
          if (val != '' && val != undefined && val != null){
            if(isNaN(val.substring(val.length - 1,val.length))){
              self.userTel = val.substring(0,val.length - 1)
            }
          }
        },
        //监听订单来源变化
        radio_source(val){
          let self = this
          if (val != 3){
            self.state1 =  ''
          }
        },
        //监听协议客户输入框，为空时重新计算房价
        state1(val){
          let self = this
          if (val == ''){
            self.roomPrcieChange()
          }
        },
        //监听是否刷新订单详情
        canRefresh(val){
          let self = this
          self.refreshOrder()
        },
      },
      created() {
        let self = this
        let formType = self.box_type //父级组件传来的参数，1：订单确认  2：实时房态  3：订单操作  4：订单支付 5：订单确认
        if (formType == 1){ //订单确认板块
          self.formCon = [true,false,false]
        }else if (formType == 2){ //实时房态板块
          self.formCon = [false,true,false]
        }else if (formType == 3){ //订单详情板块
          self.formCon = [false,false,true]
        }
        //将OTA列表渲染进数据层
        // self.onlineRetailers = self.otaList
        self.onlineRetailers = JSON.parse(localStorage.getItem('otaList'))
        //将父级组件传递来的参数进行二次封装
        if (self.toParameter != '' && self.toParameter != null && self.toParameter != 'null' && self.toParameter !=undefined){
          if (self.box_type == 1){
            self.order_parameter = self.toParameter
            let newArr2 = []
            for (let i = 0;i < self.toParameter.length; i++){
              newArr2.push({
                agreement_price:self.toParameter[i].agreement_price
              })
            }
            self.upstate({key:'oldList',val:newArr2})
            if (self.order_parameter.orderStatus == undefined){
              for (let i = 0; i < self.order_parameter.length; i++){
                self.order_parameter[i].showDate = self.order_parameter[i].date.substring(5,self.order_parameter[i].date.length)
              }
              //计算总房费
              let num = 0
              for (let i = 0; i < self.toParameter.length; i++){
                num += parseFloat(self.toParameter[i].price)
              }
              self.total = num
              self.openIntegral = self.total
            }else {
              self.userId = self.order_parameter.orderPeopleId
              self.userName = self.order_parameter.orderPeopleName
              self.userTel = self.order_parameter.orderPeopleTel
              if (self.order_parameter.orderType == 0){
                self.orderTypevalue = '1'
              }else {
                self.orderTypevalue = '2'
              }
              //开房类型 0:全日房 1:钟点房 2:免费房 3:特殊房
              if (self.order_parameter.orderRoomTypevalue == 0){
                self.roomTypevalue = '1'
              }else if (self.order_parameter.orderRoomTypevalue == 1){
                self.roomTypevalue = '2'
              }else if (self.order_parameter.orderRoomTypevalue == 2){
                self.roomTypevalue = '3'
              }else if (self.order_parameter.orderRoomTypevalue == 3){
                self.roomTypevalue = '4'
              }
              if (self.order_parameter.orderSource == 0){
                self.radio_source = '1'
              }else if (self.order_parameter.orderSource == 2){
                self.radio_source = '2'
              }else if (self.order_parameter.orderSource == 3){
                self.radio_source = '3'
              }
              self.state1 = self.order_parameter.otaName
              self.remarksInfo = self.order_parameter.orderRemarks
            }
          }
        }
      },
      mounted() {
        let self = this
        self.protocolCustomer = self.getCustomerList()
      },
      methods: {
        ...mapActions([
          'upstate'
        ]),
        //时间戳转换为日期
        timestampToTime(timestamp) {
          let date = new Date(timestamp);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
          let Y = date.getFullYear() + '-';
          let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
          let D = date.getDate() + ' ';
          return Y+M+D;
        },
        //删除已选房间(订单确认板块，会解锁房间)
        handleDelete2(index) {
          let self = this
          if (self.order_parameter.order_No == undefined){
            self.order_parameter.splice(index,1)
            let newArr = self.saveHouseList
            newArr.splice(index,1)
            self.upstate({key:'saveHouseList',val:newArr})
          }else {
            self.order_parameter.order_parameter.splice(index,1)
            let newArr = self.saveHouseList
            newArr.splice(index,1)
            self.upstate({key:'saveHouseList',val:newArr})
          }
          // self.$emit('refreshTheList',true)
        },
        //订单类型变化
        otvChange(val){
          let self = this
          self.orderTypevalue = val
          if (self.orderTypevalue == 1){ //普通订单
            self.integralButton = false
            self.isMembership = false
            self.checkedIntegral = false
          }else { //分时订单
            // console.log(self.userId,'uid')
            if (self.userId != '' && self.isMember){
              self.isMembership = true
              self.roomTypevalue = '1'
              self.radio_source = '1'
              self.radio_key = ''
            }else {
              self.orderTypevalue = '1'
              self.$message.error('只有会员才能选择分时订单');
            }
          }
        },
        //查询会员号
        searchUser(id){
          let self = this
          self.$http.post(self.conURL + 'hotel/work/getmemberinfo',{phone:id}).then(res => {
            if (res.data.code == 0){
              if (res.data.data == ''){
                self.isMember = false
                self.userName = ''
                self.userTel = ''
                self.userCode = ''
                self.membershipIntegral = 0
                this.$notify.error({
                  title: '查询失败',
                  message: '会员号/手机号不存在'
                });
              }else {
                if (res.data.data[0].is_activate == 0){ //0为已激活，1为未激活
                  if (res.data.data[0].name != ''){
                    self.userName = res.data.data[0].name
                  }else {
                    self.userName = res.data.data[0].nickname
                  }
                  self.userTel = res.data.data[0].phone
                  self.userCode = res.data.data[0].card_code
                  self.membershipIntegral = res.data.data[0].bonus
                  self.isMember = true
                  self.is_activate = true
                }else if (res.data.data[0].is_activate == 1){
                  self.is_activate = false
                  $('#userId').css({'border':'1px solid red'})
                }
              }
            }else {
              self.createMess(res.data.msg)
            }
          })
        },
        //确认是否删除房间
        confirm1(index) {
          let self = this
          this.$confirm('是否删除该房间?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            self.handleDelete2(index)
            this.$message({
              type: 'success',
              message: '删除成功!'
            });
          }).catch(() => {
            this.$message({
              type: 'info',
              message: '已取消删除'
            });
          });
        },
        //确认开房按钮点击
        confirmGetRoom(num) {
          let self = this
          self.upstate({key:'public_bc',val:true})
          //订单来源转换
          let orderSource
          let otaId = ''
          if (self.radio_source == 1){ //订单来源是前台
            orderSource = 0
          }else if (self.radio_source == 2){
            if (self.radio_key != ''){
              orderSource = 2
              otaId = self.radio_key
            }else {
              orderSource = ''
            }
          }else if (self.radio_source == 3){
            orderSource = 3
            otaId = self.project_id
          }
          // 入住类型 0:全日房 1:钟点房 2:免费房 3:特殊房;
          //开房类型转换
          let roomTypevalue
          if (self.roomTypevalue == 1){ //全天房
            roomTypevalue = 0
          }else if (self.roomTypevalue == 2){ //钟点房
            roomTypevalue = 1
          }else if (self.roomTypevalue == 3){ //特殊房
            roomTypevalue = 3
          }else { //免费房
            roomTypevalue = 2
          }
          /*
          * 下单检索
          * 1、会员姓名不能为空
          * 2、订单来源如果是电商，电商平台不能为空
          * */
          let userName = self.userName
          if (userName != '' && userName != undefined && userName != null){ //判断会员姓名是否为空
            if (self.radio_source == 2){ //判断是否是电商，如果是电商，电商平台不能为空
              if (self.radio_key == ''){ //判断电商平台是否为空
                this.$message({
                  showClose: true,
                  message: '请选择电商平台',
                  type: 'error'
                });
                self.upstate({key:'public_bc',val:false})
                return
              }
            }
          }else {
            this.$message({
              showClose: true,
              message: '预订人姓名不能为空',
              type: 'error'
            });
            self.upstate({key:'public_bc',val:false})
            return
          }
          //获取当前时间
          let time
          let date = new Date()
          let Y = date.getFullYear()
          let M = self.returnTime(date.getMonth() + 1)
          let D = self.returnTime(date.getDate())
          let h = self.returnTime(date.getHours())
          let m = self.returnTime(date.getMinutes())
          let s = self.returnTime(date.getSeconds())
          let myddy= date.getDay()
          time =  Y + '-' + M + '-' + D + ' ' + h + ':' + m + ':' + s
          let is_share_time = self.orderTypevalue
          if (self.orderTypevalue == 1){
            is_share_time = 0
          }else {
            is_share_time = 1
          }
          let houseList = [] //生成订单的房间列表
          let list = []
          if (self.order_parameter.order_No == undefined){
            list = self.order_parameter
          }else {
            list = self.order_parameter.order_parameter
          }
          for (let i = 0; i < list.length; i++){
            let price
            if (self.state1 == ''){
              if (is_share_time == 0){ //普通订单
                price = list[i].strike_price
              }else { //分时订单
                price = list[i].member_price
              }
            }else {
              price = list[i].agreement_price
            }
            let hi = ''
            let no = ''
            let date = ''
            if (list[i].roomId != undefined){
              hi = list[i].roomId
            }else {
              hi = list[i].house_id
            }
            if (list[i].roomNo != undefined){
              no = list[i].roomNo
            }else {
              no = list[i].house_no
            }
            if (list[i].date != undefined){
              date = list[i].date
            }else {
              date = list[i].lock_date
            }
            houseList.push({
              effected_at:date, //开房时间
              house_id:hi, //房间ID
              house_no:no, //房间号
              price:price //房间价格
            })
          }
          //order_status 0：未确认，1已确认
          let order_status
          if (num == 0){
            order_status = 1
          }else {
            order_status = 0
          }
          let is_integral_pay
          if (!self.checkedIntegral){ //易用豆开房
            is_integral_pay = 0
          }else {
            is_integral_pay = 1
          }
          let ota_order_type
          if (self.radio_source == 2){
            if (self.open_pay_type == 1){
              ota_order_type = 1
            }else {
              ota_order_type = 0
            }
          }
          //生成订单的订单信息
          let orderData = {
            origin: orderSource, //订单来源。0=前台，1=微信，2=OTA (现在只有前台和OTA)
            ota_id: otaId, //OTA单的ID
            ota_no: self.onlineRetailersId, //OTA单的单号
            is_share_time: is_share_time, //1 是否分时 1：是分时， 0：是普通单
            check_type:roomTypevalue, //开房类型，比如：全天房
            order_status:order_status,
            is_integral_pay:is_integral_pay,
            note:self.remarksInfo,
            ota_order_type:ota_order_type
          }
          //生成订单的用户信息
          let userData = {
            member_id:self.userCode, //会员卡号
            member_type:1, //会员类型,暂时固定传1
            book_name:self.userName, //会员姓名
            book_phone:self.userTel, //会员电话
          }
          //生成订单信息，传递给后端
          let data = {
            houseList:houseList,
            orderData:orderData,
            userData:userData
          }
          self.$http.post(self.conURL + 'hotel/work/createconfirmedorder',data).then(res => {
            // console.log(res,'res')
            if (res.data.code == 0){
              self.upstate({key:'oldList',val:[]})
              //将房间信息放入vuex
              let dataResult = res.data.data
              let parameter = []
              if (num == 0){ //开房
                parameter = { //生成订单信息
                  order_id:dataResult.id, //订单ID
                  order_No:dataResult.no, //订单编号
                  orderStatus:dataResult.order_status, //订单状态  0=未确认，1=已确认，2=已取消，3=已完成，4=已结算
                  orderPeopleId:dataResult.member_id, //会员ID
                  orderPeopleName:dataResult.book_name, //预定人
                  orderPeopleTel:dataResult.book_phone, //预订人电话
                  orderCreatedId:dataResult.creator_id, //创建人ID
                  orderCreatedName:dataResult.creator_name, //创建人姓名
                  orderCreatedTime:dataResult.created_at, //创建时间
                  orderType:dataResult.is_share_time, //订单类型 0：普通订单 1：分时订单
                  orderSource:dataResult.origin, //订单来源 0=前台，1=微信，2=OTA
                  otaName:dataResult.ota_name, //OTA名称
                  ota_order_type:dataResult.ota_order_type, //OTA类型
                  otaNo:dataResult.ota_no, //OTA单号
                  orderRemarks:dataResult.note, //备注
                  orderRoomTypevalue:dataResult.check_type, //开房类型 0:全日房 1:钟点房 2:免费房 3:特殊房
                  order_parameter:dataResult.order_houses, //房间列表
                  orderNextPay:dataResult.nextpay, //第一次支付
                  payCount:dataResult.payCount, //收支详情板块的三个数据
                  payments:dataResult.payments, //收支详情列表
                }
              }else { //保存
                parameter = { //生成订单信息
                  order_id:dataResult.id, //订单ID
                  order_No:dataResult.no, //订单编号
                  orderStatus:dataResult.order_status, //订单状态  0=未确认，1=已确认，2=已取消，3=已完成，4=已结算
                  orderPeopleId:dataResult.member_id, //会员ID
                  orderPeopleName:dataResult.book_name, //预定人
                  orderPeopleTel:dataResult.book_phone, //预订人电话
                  orderCreatedId:dataResult.creator_id, //创建人ID
                  orderCreatedName:dataResult.creator_name, //创建人姓名
                  orderCreatedTime:dataResult.created_at, //创建时间
                  orderType:dataResult.is_share_time, //订单类型 0：普通订单 1：分时订单
                  orderSource:dataResult.origin, //订单来源 0=前台，1=微信，2=OTA
                  otaName:dataResult.ota_name, //OTA名称
                  ota_order_type:dataResult.ota_order_type, //OTA类型
                  otaNo:dataResult.ota_no, //OTA单号
                  orderRemarks:dataResult.note, //备注
                  orderRoomTypevalue:dataResult.check_type, //开房类型 0:全日房 1:钟点房 2:免费房 3:特殊房
                  order_parameter:dataResult.lock_houses, //房间列表
                  payCount:dataResult.payCount, //收支详情板块的三个数据
                  payments:dataResult.payments, //收支详情列表
                }
              }
              self.upstate({key:'saveHouseList',val:[]})
              if (num == 0){
                self.upstate({key:'publicOrderInfo',val:parameter})
                self.upstate({key:'payInfo',val:parameter}) //将收支明细回传
                self.orderDeposit = dataResult.nextpay //记录押金
                self.$emit('firstPay',parameter) //将收支信息回传(收费弹窗)
              }else {
                self.upstate({key:'public_bc',val:false})
                this.$alert('订单保存成功', {
                  confirmButtonText: '确定',
                  callback: action => {
                  }
                });
                self.$emit('temporary',parameter) //将收支信息回传(收费弹窗)
              }
            }else {
              self.createMess(res.data.msg)
              self.upstate({key:'public_bc',val:false})
            }
          })
          // self.upstate({key:'publicOrderInfo',val:parameter})
        },
        //处理时间
        returnTime(num){
          if (num < 10){
            return '0' + num
          }else {
            return num
          }
        },
        //取消订单按钮点击
        cancelOrder () {
          let self = this
          this.$confirm('是否取消订单？, 是否继续?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            if (self.order_parameter.orderStatus == undefined){
              self.order_parameter = []
              self.upstate({key:'saveHouseList',val:[]})
              self.$emit('refreshAndClose',true)
              this.$message({
                type: 'success',
                message: '取消订单成功!'
              });
            }else {
              self.$http.post(self.conURL + 'hotel/work/cancelorder',{order_id:self.order_parameter.order_id}).then(res => {
                if (res.data.code == 0){
                  self.order_parameter = []
                  self.upstate({key:'saveHouseList',val:[]})
                  self.upstate({key:'oldList',val:[]})
                  self.$emit('refreshAndClose',true)
                  this.$message({
                    type: 'success',
                    message: '取消订单成功!'
                  });
                }else {
                  self.createMess(res.data.msg)
                }
              })
            }
          }).catch(() => {
            this.$message({
              type: 'info',
              message: '已取消操作'
            });
          });
        },
        //房价修改事件,重新计算房价和总收费
        roomPrcieChange(val) {
          let self = this
          if (self.orderTypevalue == 1){ //普通订单
            if (self.state1 == ''){ //不是协议客户
              if (self.roomTypevalue == 2){ //钟点房
                //计算总房费
                let num = 0
                for (let i = 0; i < self.order_parameter.length; i++){
                  num += parseFloat(self.order_parameter[i].hour_room_price)
                }
                self.total = num
                self.openIntegral = self.total
              }else {
                //计算总房费
                let num = 0
                for (let i = 0; i < self.order_parameter.length; i++){
                  num += parseFloat(self.order_parameter[i].strike_price)
                }
                self.total = num
                self.openIntegral = self.total
              }
            }else { //协议客户
              //计算总房费
              let num = 0
              for (let i = 0; i < self.order_parameter.length; i++){
                num += parseFloat(self.order_parameter[i].agreement_price)
              }
              self.total = num
              self.openIntegral = self.total
            }
          }else { //分时订单
            //计算总房费
            let num = 0
            if (self.order_parameter.order_parameter != undefined){
              if (self.order_parameter.order_parameter.length > 0){
                for (let i = 0; i < self.order_parameter.order_parameter.length; i++){
                  num += parseFloat(self.order_parameter.order_parameter[i].prices.member_price)
                }
                self.total = num
                self.openIntegral = self.total
                self.isMembership = true
                self.membershipIntegral = self.order_parameter.userInfo.bonus
              }
            }else {
              for (let i = 0; i < self.order_parameter.length; i++){
                num += parseFloat(self.order_parameter[i].member_price)
              }
              self.total = num
              self.openIntegral = self.total
            }
          }
        },
        //收款按钮点击事件
        receivables(index) {
          let self = this
          self.upstate({key:'public_bc',val:true})
          if (index == 0){ //押金
            self.$emit('backParameter',{
              isFirst:false,
              order_id:self.orderplate_info.order_id,
              title:'押金',
              subject_id:2,
              payMoney:self.orderDeposit,
              payType:0, //收费方向 0：收款 1：退款
            })
          }else if (index == 1){ //消费(需要循环房间)
            self.$emit('backParameter',{
              isFirst:false,
              order_id:self.orderplate_info.order_id,
              title:'消费',
              subject_id:5,
              houseList:self.orderplate_info.order_parameter,
              payType:0,
              haveReceivables:true
            })
          }else if (index == 2){ //收款
            self.$emit('backParameter',{
              isFirst:false,
              order_id:self.orderplate_info.order_id,
              title:'收款',
              payMoney:0,
              payType:0,
              subject_id:3,
            })
          }else if (index == 3){ //退款
            self.$emit('backParameter',{
              isFirst:false,
              order_id:self.orderplate_info.order_id,
              title:'退款',
              payMoney:0,
              payType:1,
              subject_id:4,
            })
          }else { //结账离店
            if (self.recordRevenue_total < self.recordRevenue_consumption){ //应收
              if (self.orderplate_info.orderSource != 3){ //不是协议客户
                self.$emit('backParameter',{
                  isFirst:false,
                  order_id:self.orderplate_info.order_id,
                  title:'结账-收款',
                  payMoney:self.recordRevenue_receivables,
                  payType:0,
                  subject_id:3,
                  is_Checkout:true
                })
              }else { //是协议客户
                self.$http.post(self.conURL + 'hotel/work/getagreementcustomer',{order_id:self.orderplate_info.order_id}).then(res => {
                  if (res.data.code == 0){
                    let creditLine = res.data.data.can_use_amount //可用的授信额度
                    self.$emit('backParameter',{
                      isFirst:false,
                      order_id:self.orderplate_info.order_id,
                      title:'结账-收款',
                      payMoney:self.recordRevenue_receivables,
                      payType:0,
                      subject_id:3,
                      is_Checkout:true,
                      is_agreement:true,
                      creditLine:creditLine
                    })
                  }else {
                    self.createMess(res.data.msg)
                  }
                })
              }
            }else if (self.recordRevenue_total > self.recordRevenue_consumption){ //应退
              self.$emit('backParameter',{
                isFirst:false,
                order_id:self.orderplate_info.order_id,
                title:'结账-退款',
                payMoney:self.recordRevenue_receivables,
                payType:1,
                subject_id:4,
                is_Checkout:true
              })
            }else { //已结清
              this.$confirm('是否结账?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
              }).then(() => {
                self.$http.post(self.conURL + 'hotel/work/createpay',{
                  order_id:self.orderplate_info.order_id,
                  is_order_done:1
                }).then(res => {
                  if (res.data.code == 0){
                    self.upstate({key:'public_is_Loading',val:false})
                    // console.log(res.data.data,'res')
                    let dataResult = res.data.data
                    let parameter = { //生成订单信息
                      bill_status:dataResult.bill_status,
                      order_id:dataResult.id, //订单ID
                      order_No:dataResult.no, //订单编号
                      orderStatus:dataResult.order_status, //订单状态  0=未确认，1=已确认，2=已取消，3=已完成，4=已结算
                      orderPeopleId:dataResult.member_id, //会员ID
                      orderPeopleName:dataResult.book_name, //预定人
                      orderPeopleTel:dataResult.book_phone, //预订人电话
                      orderCreatedId:dataResult.creator_id, //创建人ID
                      orderCreatedName:dataResult.creator_name, //创建人姓名
                      orderCreatedTime:dataResult.created_at, //创建时间
                      orderType:dataResult.is_share_time, //订单类型 0：普通订单 1：分时订单
                      orderSource:dataResult.origin, //订单来源 0=前台，1=微信，2=OTA
                      otaName:dataResult.ota_name, //OTA名称
                      ota_order_type:dataResult.ota_order_type, //OTA类型
                      otaNo:dataResult.ota_no, //OTA单号
                      orderRemarks:dataResult.note, //备注
                      orderRoomTypevalue:dataResult.check_type, //开房类型 0:全日房 1:钟点房 2:免费房 3:特殊房
                      order_parameter:dataResult.order_houses, //房间列表
                      orderNextPay:dataResult.nextpay, //第一次支付
                      orderPayments:dataResult.payments, //收支明细
                      payCount:dataResult.payCount, //收支详情板块的三个数据
                    }
                    // console.log(parameter,'parameter')
                    self.upstate({key:'publicOrderInfo',val:parameter})
                    self.upstate({key:'payInfo',val:dataResult.payments}) //将收支明细回传
                    self.upstate({key:'public_bc',val:false})
                    self.$http.post(self.conURL + 'hotel/hotel/printdetail',{order_id:dataResult.id}).then(ress => {
                      if(ress.data.code == 0){
                        self.upstate({key:'jzPrint',val:ress.data.data})
                      }else {
                        self.createMess(ress.data.msg)
                      }
                    })
                    this.$message({
                      type: 'success',
                      message: '结账成功!'
                    });
                  }else {
                    self.upstate({key:'public_is_Loading',val:false})
                    self.upstate({key:'public_bc',val:false})
                    self.createMess(res.data.msg)
                  }
                })
              }).catch(() => {
                this.$message({
                  type: 'info',
                  message: '已取消'
                });
                self.upstate({key:'public_bc',val:false})
              });
            }
          }
        },
        //收款按钮点击事件(订单确认板块)
        receivables2(index) {
          let self = this
          if (index == 1){ //收款
            self.$emit('backParameter',{
              isFirst:false,
              order_id:self.order_parameter.order_id,
              title:'收款',
              payMoney:0,
              payType:0,
              subject_id:3,
              isConfirm:true
            })
          }else if (index == 2){ //退款
            self.$emit('backParameter',{
              isFirst:false,
              order_id:self.order_parameter.order_id,
              title:'退款',
              payMoney:0,
              payType:1,
              subject_id:4,
              isConfirm:true
            })
          }
        },
        //点击易用豆开房事件
        integralChange(val){
          let self = this
          if (val){
            let msi = self.membershipIntegral
            let oi = self.openIntegral
            if (msi >= oi){
              self.integralButton = false
            }else {
              self.integralButton = true
            }
          }else {
            self.integralButton = false
          }
        },
        //收支明细详情点击事件
        payInfoDetail(row){
          let self = this
          let newArr = []
          self.upstate({key:'public_bc',val:true})
          //pay_type:0 收款 pay_type:1 消费
          if (row.pay_type == 0){
            newArr = {
              subject_id:row.subject_id,
              pay_type:row.pay_type,
              payId:row.id,
              payAccount:row.account_name,
              paySelect:row.subject_name,
              payMoney:row.money,
              payName:row.creator_name,
              payTime:row.pay_at,
              payRemarks:row.note,
              account_name:row.account_name,
              pay_status:row.pay_status,
              name:row.name
            }
            self.$emit('showPayDetail',newArr)
          }else if (row.pay_type == 1){
            if (row.refund_money != undefined && row.refund_money != null && row.refund_money != '' && row.refund_money > 0){
              self.$http.post(self.conURL + 'hotel/work/getwriteofflist',{payment_id:row.id}).then(res => {
                if (res.data.code == 0){
                  newArr = {
                    pay_type:row.pay_type,
                    payId:row.id,
                    payAccount:row.account_name,
                    paySelect:row.subject_name,
                    payMoney:row.money,
                    payName:row.creator_name,
                    payTime:row.pay_at,
                    payRemarks:row.note,
                    chooseRoom:row.house_no,
                    pay_status:row.pay_status,
                    flushingInfo:res.data.data,
                    name:row.name
                  }
                  self.$emit('showPayDetail',newArr)
                }else {
                  self.createMess(res.data.msg)
                }
              })
            }else {
              newArr = {
                pay_type:row.pay_type,
                payId:row.id,
                payAccount:row.account_name,
                paySelect:row.subject_name,
                payMoney:row.money,
                payName:row.creator_name,
                payTime:row.pay_at,
                payRemarks:row.note,
                chooseRoom:row.house_no,
                pay_status:row.pay_status,
                name:row.name
              }
              self.$emit('showPayDetail',newArr)
            }
          }
        },
        //收款列表，微信支付时退款点击
        payInfoRefund(row){
          let self = this
          let maxRefund = {
            id:row.id,
            money:parseFloat(row.money) - parseFloat(row.refund_money)
          } //传递的最大可退金额参数
          self.$emit('maxRefund',{
            maxRefund:maxRefund
          })
        },
        //入住登记
        check_in(house_no,room_name,id){
          let self = this
          self.upstate({key:'public_bc',val:true})
          self.$emit('checkIn',{
            roomNo:house_no,
            roomType:room_name,
            roomId:id
          })
        },
        //查询入住信息
        check_search(house_no,room_name,id){
          let self = this
          self.$http.post(self.conURL + 'hotel/work/getguests',{
            order_house_id:id
          }).then(res => {
            if (res.data.code == 0){
              // console.log(res.data.data)
              self.upstate({key:'public_bc',val:true})
              let newArr = []
              if (res.data.data.length == 0){
                newArr.push({
                  name:'',
                  cardType:'',
                  cardId:''
                })
              }else {
                for (let i = 0; i < res.data.data.length; i++){
                  let name,cardType,cardId
                  if (res.data.data[i].name != null){
                    name = res.data.data[i].name
                  }else {
                    name = ''
                  }
                  if (res.data.data[i].id_type != null){
                    cardType = res.data.data[i].id_type
                  }else {
                    cardType = ''
                  }
                  if (res.data.data[i].id_card != null){
                    cardId = res.data.data[i].id_card
                  }else {
                    cardId = ''
                  }
                  newArr.push({
                    name:name,
                    cardType:cardType,
                    cardId:cardId
                  })
                }
              }
              self.$emit('checkSearch',{
                roomNo:house_no,
                roomType:room_name,
                roomId:id,
                list:newArr,
                houst_status:1
              })
            }else {
              self.createMess(res.data.msg)
            }
          })
        },
        //续房操作
        continuedRoom(house_no,room_name,id){
          let self = this
          self.upstate({key:'public_bc',val:true})
          self.$emit('continuedHouses',{
            order_house_id:id,
            house_no:house_no,
            room_name:room_name
          })
          self.$emit('refreshRoomList_RT',true)
        },
        //换房操作
        exchangHouses(id){
          let self = this
          self.upstate({key:'public_bc',val:true})
          self.$http.post(self.conURL + 'hotel/work/gethouseforchange',{order_house_id:id}).then(res => {
            if (res.data.code == 0){
              self.$emit('exchangHouses',{
                parameter:res.data.data,
                order_house_id:id
              })
              self.$emit('refreshRoomList_RT',true)
            }else {
              self.createMess(res.data.msg)
            }
          })
        },
        //退房操作
        checkOut(houseNo,roomName,id){
          let self = this
          self.upstate({key:'public_bc',val:true})
          self.$http.post(self.conURL + 'hotel/work/getcheckoutdata',{order_house_id:id}).then(res => {
            if (res.data.code == 0){
              // console.log(res.data.data)
              if (res.data.data.check_out_type == 0){ //正常退房
                this.$confirm('是否退房?', '提示', {
                  confirmButtonText: '确定',
                  cancelButtonText: '取消',
                  type: 'warning'
                }).then(() => {
                  this.$message({
                    type: 'success',
                    message: '退房成功!'
                  });
                  self.upstate({key:'public_is_Loading',val:true})
                  self.$http.post(self.conURL + 'hotel/work/checkout',{order_house_id:id,check_out_type:res.data.data.check_out_type}).then(res => {
                    if (res.data.code == 0){
                      let dataResult = res.data.data
                      let parameter = { //生成订单信息
                        bill_status:dataResult.bill_status,
                        order_id:dataResult.id, //订单ID
                        order_No:dataResult.no, //订单编号
                        orderStatus:dataResult.order_status, //订单状态  0=未确认，1=已确认，2=已取消，3=已完成，4=已结算
                        orderPeopleId:dataResult.member_id, //会员ID
                        orderPeopleName:dataResult.book_name, //预定人
                        orderPeopleTel:dataResult.book_phone, //预订人电话
                        orderCreatedId:dataResult.creator_id, //创建人ID
                        orderCreatedName:dataResult.creator_name, //创建人姓名
                        orderCreatedTime:dataResult.created_at, //创建时间
                        orderType:dataResult.is_share_time, //订单类型 0：普通订单 1：分时订单
                        orderSource:dataResult.origin, //订单来源 0=前台，1=微信，2=OTA
                        otaName:dataResult.ota_name, //OTA名称
                        ota_order_type:dataResult.ota_order_type, //OTA类型
                        otaNo:dataResult.ota_no, //OTA单号
                        orderRemarks:dataResult.note, //备注
                        orderRoomTypevalue:dataResult.check_type, //开房类型 0:全日房 1:钟点房 2:免费房 3:特殊房
                        order_parameter:dataResult.order_houses, //房间列表
                        orderNextPay:dataResult.nextpay, //第一次支付
                        payCount:dataResult.payCount, //收支详情板块的三个数据
                        payments:dataResult.payments, //收支详情列表
                      }
                      // console.log(parameter,'parameter')
                      self.upstate({key:'publicOrderInfo',val:parameter})
                      self.upstate({key:'payInfo',val:dataResult.payments}) //将收支明细回传
                      self.upstate({key:'public_is_Loading',val:false})
                      self.$emit('refreshTheListOrder',true)
                    }else {
                      self.createMess(res.data.msg)
                    }
                  })
                })
              }else { //提前退房
                if (res.data.data.check_out_type == 1){
                  self.$emit('checkOutPra',{
                    house_no:houseNo, //房间号
                    room_name:roomName, //房间类型名
                    order_house_id:id, //房间Id
                    house_list:res.data.data.houseList, //房间列表
                    check_out_type:res.data.data.check_out_type
                  })
                }else if (res.data.data.check_out_type == 2){
                  self.$emit('checkOutPra',{
                    house_no:houseNo, //房间号
                    room_name:roomName, //房间类型名
                    order_house_id:id, //房间Id
                    check_out_type:res.data.data.check_out_type,
                    data:res.data.data
                  })
                }
              }
            }else {
              self.createMess(res.data.msg)
            }
          })
        },
        //取消单个房间
        cancelRoom(houseNo,roomName,id){
          let self = this
          self.upstate({key:'public_bc',val:true})
          self.$http.post(self.conURL + 'hotel/work/getcancelhousedata',{order_house_id:id}).then(res => {
            if (res.data.code == 0){
              self.$emit('cancelPra',{
                isCancel:true,
                house_no:houseNo, //房间号
                room_name:roomName, //房间类型名
                order_house_id:id, //房间Id
                house_list:res.data.data.houseList, //房间列表
                check_out_type:1,
              })
            }else {
              self.createMess(res.data.msg)
            }
          })
        },
        //单个房间详情
        houseDetails(houseNo,roomName,id){
          let self = this
          self.upstate({key:'public_bc',val:true})
          self.$http.post(self.conURL + 'hotel/work/gethousedates',{order_house_id:id}).then(res => {
            if (res.data.code == 0){
              self.$emit('houseDetails',{
                house_no:houseNo, //房间号
                room_name:roomName, //房间类型名
                order_house_id:id, //房间Id
                datas:res.data.data
              })
            }else {
              self.createMess(res.data.msg)
            }
          })
        },
        //消费/收款显示方法
        showTab(val){
          let self = this
          if (val == 0){ //收入
            if (self.orderPayInfoListShow_0){
              self.orderPayInfoListShow_0 = false
            }else {
              self.orderPayInfoListShow_0 = true
            }
          }else { //消费
            if (self.orderPayInfoListShow_1){
              self.orderPayInfoListShow_1 = false
            }else {
              self.orderPayInfoListShow_1 = true
            }
          }
        },
        //平台对账按钮
        reconciliation(bill_status){
          let self = this
          self.upstate({key:'public_bc',val:true})
          self.$http.post(self.conURL + 'hotel/work/completeorder',{order_id:self.orderplate_info.order_id}).then(res => {
            if (res.data.code == 0){
              res.data.data.bill_status = bill_status
              self.$emit('reconciliation',res.data.data)
            }else {
              self.createMess(res.data.msg)
            }
          })
        },
        //待确认订单按钮
        confirmButton(boo){
          let self = this
          if (boo){
            self.$http.post(self.conURL + 'hotel/work/confirmorder',{order_id:self.orderplate_info.order_id}).then(res => {
              if (res.data.code == 0){
                let dataResult = res.data.data
                let parameter = { //生成订单信息
                  order_id:dataResult.id, //订单ID
                  order_No:dataResult.no, //订单编号
                  orderStatus:dataResult.order_status, //订单状态  0=未确认，1=已确认，2=已取消，3=已完成，4=已结算
                  orderPeopleId:dataResult.member_id, //会员ID
                  orderPeopleName:dataResult.book_name, //预定人
                  orderPeopleTel:dataResult.book_phone, //预订人电话
                  orderCreatedId:dataResult.creator_id, //创建人ID
                  orderCreatedName:dataResult.creator_name, //创建人姓名
                  orderCreatedTime:dataResult.created_at, //创建时间
                  orderType:dataResult.is_share_time, //订单类型 0：普通订单 1：分时订单
                  orderSource:dataResult.origin, //订单来源 0=前台，1=微信，2=OTA
                  otaName:dataResult.ota_name, //OTA名称
                  ota_order_type:dataResult.ota_order_type, //OTA类型
                  otaNo:dataResult.ota_no, //OTA单号
                  orderRemarks:dataResult.note, //备注
                  orderRoomTypevalue:dataResult.check_type, //开房类型 0:全日房 1:钟点房 2:免费房 3:特殊房
                  order_parameter:dataResult.order_houses, //房间列表
                  orderNextPay:dataResult.nextpay, //第一次支付
                  payCount:dataResult.payCount, //收支详情板块的三个数据
                  payments:dataResult.payments, //收支详情列表
                }
                // console.log(parameter,'parameter')
                self.upstate({key:'publicOrderInfo',val:parameter})
                self.upstate({key:'payInfo',val:dataResult.payments}) //将收支明细回传
                self.orderDeposit = dataResult.nextpay //记录押金
                self.$emit('firstPay',parameter) //将收支信息回传(收费弹窗)
              }else {
                self.createMess(res.data.msg)
              }
            })
          }else {
            self.$http.post(self.conURL + 'hotel/work/cancelorder',{order_id:self.orderplate_info.order_id}).then(res => {
              if (res.data.code == 0){
                let dataResult = res.data.data
                let parameter = { //生成订单信息
                  order_id:dataResult.id, //订单ID
                  order_No:dataResult.no, //订单编号
                  orderStatus:dataResult.order_status, //订单状态  0=未确认，1=已确认，2=已取消，3=已完成，4=已结算
                  orderPeopleId:dataResult.member_id, //会员ID
                  orderPeopleName:dataResult.book_name, //预定人
                  orderPeopleTel:dataResult.book_phone, //预订人电话
                  orderCreatedId:dataResult.creator_id, //创建人ID
                  orderCreatedName:dataResult.creator_name, //创建人姓名
                  orderCreatedTime:dataResult.created_at, //创建时间
                  orderType:dataResult.is_share_time, //订单类型 0：普通订单 1：分时订单
                  orderSource:dataResult.origin, //订单来源 0=前台，1=微信，2=OTA
                  otaName:dataResult.ota_name, //OTA名称
                  ota_order_type:dataResult.ota_order_type, //OTA类型
                  otaNo:dataResult.ota_no, //OTA单号
                  orderRemarks:dataResult.note, //备注
                  orderRoomTypevalue:dataResult.check_type, //开房类型 0:全日房 1:钟点房 2:免费房 3:特殊房
                  order_parameter:dataResult.order_houses, //房间列表
                  orderNextPay:dataResult.nextpay, //第一次支付
                  payCount:dataResult.payCount, //收支详情板块的三个数据
                  payments:dataResult.payments, //收支详情列表
                }
                // console.log(parameter,'parameter')
                self.upstate({key:'publicOrderInfo',val:parameter})
                self.upstate({key:'payInfo',val:dataResult.payments}) //将收支明细回传
                self.orderDeposit = dataResult.nextpay //记录押金
              }else {
                self.createMess(res.data.msg)
              }
            })
          }
        },
        //微信订单确认
        confirmWeChat(){
          let self = this
          self.upstate({key:'public_is_Loading',val:true})
          self.$http.post(self.conURL + 'hotel/work/confirmweixinorder',{order_id:self.orderplate_info.order_id}).then(res => {
            if (res.data.code == 0){
              let dataResult = res.data.data
              let parameter = { //生成订单信息
                order_id:dataResult.id, //订单ID
                order_No:dataResult.no, //订单编号
                orderStatus:dataResult.order_status, //订单状态  0=未确认，1=已确认，2=已取消，3=已完成，4=已结算
                orderPeopleId:dataResult.member_id, //会员ID
                orderPeopleName:dataResult.book_name, //预定人
                orderPeopleTel:dataResult.book_phone, //预订人电话
                orderCreatedId:dataResult.creator_id, //创建人ID
                orderCreatedName:dataResult.creator_name, //创建人姓名
                orderCreatedTime:dataResult.created_at, //创建时间
                orderType:dataResult.is_share_time, //订单类型 0：普通订单 1：分时订单
                orderSource:dataResult.origin, //订单来源 0=前台，1=微信，2=OTA
                otaName:dataResult.ota_name, //OTA名称
                ota_order_type:dataResult.ota_order_type, //OTA类型
                otaNo:dataResult.ota_no, //OTA单号
                orderRemarks:dataResult.note, //备注
                orderRoomTypevalue:dataResult.check_type, //开房类型 0:全日房 1:钟点房 2:免费房 3:特殊房
                order_parameter:dataResult.order_houses, //房间列表
                orderNextPay:dataResult.nextpay, //第一次支付
                payCount:dataResult.payCount, //收支详情板块的三个数据
                payments:dataResult.payments, //收支详情列表
              }
              // console.log(parameter,'parameter')
              self.upstate({key:'publicOrderInfo',val:parameter})
              self.upstate({key:'payInfo',val:dataResult.payments}) //将收支明细回传
              self.orderDeposit = dataResult.nextpay //记录押金
              self.upstate({key:'public_is_Loading',val:false})
              self.$emit('firstPay',parameter) //将收支信息回传(收费弹窗)
            }else {
              self.createMess(res.data.msg)
            }
          })
        },
        //修改/确认预定订单
        confirmGetRoomUpdate(num){
          //mark
          let self = this
          //订单来源转换
          let orderSource
          let otaId = ''
          if (self.radio_source == 1){ //订单来源是前台
            orderSource = 0
          }else if (self.radio_source == 2) {
            if (self.radio_key != ''){
              orderSource = 2
              otaId = self.radio_key
            }else {
              orderSource = ''
            }
          }else if (self.radio_source == 3){
            orderSource = 3
            otaId = self.order_parameter.ota_id
          }
          // 入住类型 0:全日房 1:钟点房 2:免费房 3:特殊房;
          //开房类型转换
          let roomTypevalue
          if (self.roomTypevalue == 1){ //全天房
            roomTypevalue = 0
          }else if (self.roomTypevalue == 2){ //钟点房
            roomTypevalue = 1
          }else if (self.roomTypevalue == 3){ //特殊房
            roomTypevalue = 3
          }else { //免费房
            roomTypevalue = 2
          }
          /*
          * 下单检索
          * 1、会员姓名不能为空
          * 2、订单来源如果是电商，电商平台不能为空
          * */
          let userName = self.userName
          if (userName != '' && userName != undefined && userName != null){ //判断会员姓名是否为空
            if (self.radio_source == 2){ //判断是否是电商，如果是电商，电商平台不能为空
              if (self.radio_key == ''){ //判断电商平台是否为空
                this.$message({
                  showClose: true,
                  message: '请选择电商平台',
                  type: 'error'
                });
                return
              }
            }
          }else {
            this.$message({
              showClose: true,
              message: '预订人姓名不能为空',
              type: 'error'
            });
            return
          }
          //获取当前时间
          let time
          let date = new Date()
          let Y = date.getFullYear()
          let M = self.returnTime(date.getMonth() + 1)
          let D = self.returnTime(date.getDate())
          let h = self.returnTime(date.getHours())
          let m = self.returnTime(date.getMinutes())
          let s = self.returnTime(date.getSeconds())
          let myddy= date.getDay()
          time =  Y + '-' + M + '-' + D + ' ' + h + ':' + m + ':' + s
          let is_share_time = self.orderTypevalue
          if (self.orderTypevalue == 1){
            is_share_time = 0
          }else {
            is_share_time = 1
          }
          let houseList = [] //生成订单的房间列表
          let list = []
          if (self.order_parameter.order_No == undefined){
            list = self.order_parameter
          }else {
            list = self.order_parameter.order_parameter
          }
          for (let i = 0; i < list.length; i++){
            let price
            if (self.state1 == ''){
              if (is_share_time == 0){ //普通订单
                price = list[i].prices.strike_price
              }else { //分时订单
                price = list[i].prices.member_price
              }
            }else {
              price = list[i].prices.agreement_price
            }
            let hi = ''
            let no = ''
            let date = ''
            if (list[i].roomId != undefined){
              hi = list[i].roomId
            }else {
              hi = list[i].house_id
            }
            if (list[i].roomNo != undefined){
              no = list[i].roomNo
            }else {
              no = list[i].house_no
            }
            if (list[i].date != undefined){
              date = list[i].date
            }else {
              date = list[i].lock_date
            }
            houseList.push({
              effected_at:date, //开房时间
              house_id:hi, //房间ID
              house_no:no, //房间号
              price:price //房间价格
            })
          }

          //order_status 0：未确认，1已确认
          let order_status
          if (num == 1){ //0：修改 1：确认开房
            order_status = 0
          }else {
            order_status = 1
          }
          let is_integral_pay
          if (!self.checkedIntegral){ //易用豆开房
            is_integral_pay = 0
          }else {
            is_integral_pay = 1
          }
          //生成订单的订单信息
          let orderData = {
            origin: orderSource, //订单来源。0=前台，1=微信，2=OTA (现在只有前台和OTA)
            ota_id: otaId, //OTA单的ID
            ota_no: self.onlineRetailersId, //OTA单的单号
            is_share_time: is_share_time, //1 是否分时 1：是分时， 0：是普通单
            check_type:roomTypevalue, //开房类型，比如：全天房
            order_status:order_status,
            order_id:self.order_parameter.order_id,
            is_integral_pay:is_integral_pay //0：修改，1：确认
          }
          //生成订单的用户信息
          let userData = {
            member_id:self.userCode, //会员卡号
            member_type:1, //会员类型,暂时固定传1
            book_name:self.userName, //会员姓名
            book_phone:self.userTel, //会员电话
          }
          //生成订单信息，传递给后端
          let data = {
            houseList:houseList,
            orderData:orderData,
            userData:userData
          }
          self.$http.post(self.conURL + 'hotel/work/confirmorder',data).then(res => {
            // console.log(res,'res')
            let dataResult = res.data.data
            if (res.data.code == 0){
              //将房间信息放入vuex
              if (num == 1){
                let parameter = { //生成订单信息
                  order_id:dataResult.id, //订单ID
                  order_No:dataResult.no, //订单编号
                  orderStatus:dataResult.order_status, //订单状态  0=未确认，1=已确认，2=已取消，3=已完成，4=已结算
                  orderPeopleId:dataResult.member_id, //会员ID
                  orderPeopleName:dataResult.book_name, //预定人
                  orderPeopleTel:dataResult.book_phone, //预订人电话
                  orderCreatedId:dataResult.creator_id, //创建人ID
                  orderCreatedName:dataResult.creator_name, //创建人姓名
                  orderCreatedTime:dataResult.created_at, //创建时间
                  orderType:dataResult.is_share_time, //订单类型 0：普通订单 1：分时订单
                  orderSource:dataResult.origin, //订单来源 0=前台，1=微信，2=OTA
                  otaName:dataResult.ota_name, //OTA名称
                  ota_order_type:dataResult.ota_order_type, //OTA类型
                  otaNo:dataResult.ota_no, //OTA单号、
                  orderRemarks:dataResult.note, //备注
                  orderRoomTypevalue:dataResult.check_type, //开房类型 0:全日房 1:钟点房 2:免费房 3:特殊房
                  order_parameter:dataResult.lock_houses, //房间列表
                  payCount:dataResult.payCount, //收支详情板块的三个数据
                  payments:dataResult.payments, //收支详情列表
                }
                // console.log(parameter,'parameter')
                self.upstate({key:'publicOrderInfo',val:parameter})
                self.upstate({key:'payInfo',val:dataResult.payments}) //将收支明细回传
                self.orderDeposit = dataResult.nextpay //记录押金
                self.upstate({key:'saveHouseList',val:[]})
                self.$emit('temporary',parameter) //将收支信息回传(收费弹窗)
              }else {
                //将房间信息放入vuex
                let parameter = { //生成订单信息
                  order_id:dataResult.id, //订单ID
                  order_No:dataResult.no, //订单编号
                  orderStatus:dataResult.order_status, //订单状态  0=未确认，1=已确认，2=已取消，3=已完成，4=已结算
                  orderPeopleId:dataResult.member_id, //会员ID
                  orderPeopleName:dataResult.book_name, //预定人
                  orderPeopleTel:dataResult.book_phone, //预订人电话
                  orderCreatedId:dataResult.creator_id, //创建人ID
                  orderCreatedName:dataResult.creator_name, //创建人姓名
                  orderCreatedTime:dataResult.created_at, //创建时间
                  orderType:dataResult.is_share_time, //订单类型 0：普通订单 1：分时订单
                  orderSource:dataResult.origin, //订单来源 0=前台，1=微信，2=OTA
                  otaName:dataResult.ota_name, //OTA名称
                  ota_order_type:dataResult.ota_order_type, //OTA类型
                  otaNo:dataResult.ota_no, //OTA单号
                  orderRemarks:dataResult.note, //备注
                  orderRoomTypevalue:dataResult.order_houses[0].check_type, //开房类型 0:全日房 1:钟点房 2:免费房 3:特殊房
                  order_parameter:dataResult.order_houses, //房间列表
                  orderNextPay:dataResult.nextpay, //第一次支付
                  payCount:dataResult.payCount, //收支详情板块的三个数据
                  payments:dataResult.payments, //收支详情列表
                }
                self.upstate({key:'publicOrderInfo',val:parameter})
                self.upstate({key:'payInfo',val:parameter}) //将收支明细回传
                self.orderDeposit = dataResult.nextpay //记录押金
                self.upstate({key:'saveHouseList',val:[]})
                self.$emit('firstPay',parameter) //将收支信息回传(收费弹窗)
              }
            }else {
              self.createMess(res.data.msg)
            }
          })
          // self.upstate({key:'publicOrderInfo',val:parameter})

        },
        //联系电话失去焦点事件
        telBlur(){
          let self = this
          let isPhone = /^1[3|4|5|7|8][0-9]{9}$/
          if (self.userTel != ''){
            if(!isPhone.test(self.userTel)){
              this.$alert('请输入正确的手机号', {
                confirmButtonText: '确定',
                callback: action => {
                  $('#userTel').css({border:'1px solid red'})
                  $('#userTel').focus()
                }
              });
            }else {
              $('#userTel').css({border:'1px solid #dcdfe6'})
            }
          }else {
            $('#userTel').css({border:'1px solid #dcdfe6'})
          }
        },
        //刷新订单详情
        refreshOrder(){
          let self = this
          self.upstate({key:'public_is_Loading',val:true})
          self.$http.post(self.conURL + 'hotel/work/getorderdetail',{order_id:self.orderplate_info.order_id}).then(res => {
            if (res.data.code == 0){
              self.upstate({key:'public_is_Loading',val:false})
              let dataResult = res.data.data
              let otaNmae = ''
              //OTA订单来源不为空时，读取OTA名称
              if (res.data.data.ota_id != null){
                let list = JSON.parse(localStorage.getItem('otaList'))
                for (let i = 0; i< list.length; i++){
                  if (list[i].ota_id == res.data.data.ota_id){
                    otaNmae = list[i].ota_name
                  }
                }
              }
              if (dataResult.origin != 1){
                let bill_status = 999;
                if (dataResult.bill_status != undefined && dataResult.bill_status != null){
                  bill_status = dataResult.bill_status
                }
                let parameter = { //生成订单信息
                  bill_status:bill_status, //平台对账是否完成
                  order_id:dataResult.id, //订单ID
                  order_No:dataResult.no, //订单编号
                  orderStatus:dataResult.order_status, //订单状态  0=未确认，1=已确认，2=已取消，3=已完成，4=已结算
                  orderPeopleId:dataResult.member_id, //会员ID
                  orderPeopleName:dataResult.book_name, //预定人
                  orderPeopleTel:dataResult.book_phone, //预订人电话
                  orderCreatedId:dataResult.creator_id, //创建人ID
                  orderCreatedName:dataResult.creator_name, //创建人姓名
                  orderCreatedTime:dataResult.created_at, //创建时间
                  orderType:dataResult.is_share_time, //订单类型 0：普通订单 1：分时订单
                  orderSource:dataResult.origin, //订单来源 0=前台，1=微信，2=OTA
                  otaName:otaNmae, //OTA名称
                  ota_order_type:dataResult.ota_order_type, //OTA类型
                  ota_id:dataResult.ota_id, //OTAId
                  otaNo:dataResult.ota_no, //OTA单号
                  orderRemarks:dataResult.note, //备注
                  orderRoomTypevalue:dataResult.check_type, //开房类型 0:全日房 1:钟点房 2:免费房 3:特殊房
                  order_parameter:dataResult.order_houses, //房间列表
                  orderNextPay:dataResult.nextpay, //第一次支付
                  payCount:dataResult.payCount, //收支详情板块的三个数据
                  payments:dataResult.payments, //收支详情列表
                }
                self.upstate({key:'publicOrderInfo',val:parameter})
                self.upstate({key:'payInfo',val:dataResult.payments}) //将收支明细回传
              }else {
                let bill_status = 999;
                if (dataResult.bill_status != undefined && dataResult.bill_status != null){
                  bill_status = dataResult.bill_status
                }
                let parameter = { //生成订单信息
                  bill_status:bill_status, //平台对账是否完成
                  order_id:dataResult.id, //订单ID
                  order_No:dataResult.no, //订单编号
                  orderStatus:dataResult.order_status, //订单状态  0=未确认，1=已确认，2=已取消，3=已完成，4=已结算
                  orderPeopleId:dataResult.member_id, //会员ID
                  orderPeopleName:dataResult.book_name, //预定人
                  orderPeopleTel:dataResult.book_phone, //预订人电话
                  orderCreatedId:dataResult.creator_id, //创建人ID
                  orderCreatedName:dataResult.creator_name, //创建人姓名
                  orderCreatedTime:dataResult.created_at, //创建时间
                  orderType:dataResult.is_share_time, //订单类型 0：普通订单 1：分时订单
                  orderSource:dataResult.origin, //订单来源 0=前台，1=微信，2=OTA
                  otaName:'微信小程序', //OTA名称
                  ota_order_type:dataResult.ota_order_type, //OTA类型
                  ota_id:dataResult.ota_id, //OTAId
                  otaNo:dataResult.ota_no, //OTA单号
                  orderRemarks:dataResult.note, //备注
                  orderRoomTypevalue:dataResult.check_type, //开房类型 0:全日房 1:钟点房 2:免费房 3:特殊房
                  order_parameter:dataResult.order_houses, //房间列表
                  orderNextPay:dataResult.nextpay, //第一次支付
                  payCount:dataResult.payCount, //收支详情板块的三个数据
                  payments:dataResult.payments, //收支详情列表
                  isWechat:true, //来自微信小程序
                  pay_status:dataResult.pay_status
                }
                console.log(parameter)
                self.upstate({key:'publicOrderInfo',val:parameter})
                self.upstate({key:'payInfo',val:dataResult.payments}) //将收支明细回传
              }
            }else {
              self.createMess(parameter.res.data.msg)
            }
          })
        },
        //刷新微信支付状态
        refreshPaying(row){
          let self = this
          self.upstate({key:'public_is_Loading',val:true})
          if (row.pay_direction == 0){
            self.$http.post(self.conURL + 'hotel/work/querypay',{
              payment_id:row.id
            }).then(res => {
              if (res.data.code == 0){
                // console.log(res.data.data.pay_status,'轮询')
                if (res.data.data.pay_status != 1){
                  self.refreshOrder()
                }else {
                  self.upstate({key:'public_is_Loading',val:false})
                }
              }else {
                self.createMess(res.data.msg)
              }
            })
          }else if (row.pay_direction == 1){
            self.$http.post(self.conURL + 'hotel/work/queryrefund',{
              payment_id:row.id
            }).then(res => {
              if (res.data.code == 0){
                // console.log(res.data.data.pay_status,'轮询')
                if (res.data.data.pay_status != 1){
                  self.refreshOrder()
                }else {
                  self.upstate({key:'public_is_Loading',val:false})
                }
              }else {
                self.createMess(res.data.msg)
              }
            })
          }
        },
        //支付中取消
        cancelPay(row){
          let self = this
          self.$http.post(self.conURL + 'hotel/work/cancelpay',{payment_id:row.id}).then(res => {
            if (res.data.code == 0){
              self.refreshOrder()
            }else {
              self.createMess(res.data.msg)
            }
          })
        },
        //会员号填写回车事件
        saoma(){
          let self = this
          self.searchUser(self.userId)
        },
        //点击打印明细
        printClick(id){
          let self = this
          self.$http.post(self.conURL + 'hotel/hotel/printdetail',{order_id:id}).then(ress => {
            if(ress.data.code == 0){
              self.upstate({key:'jzPrint',val:ress.data.data})
            }else {
              self.createMess(ress.data.msg)
            }
          })
        },
        //冲调
        flushing(row){
          let self = this
          let money = 0
          if(row.refund_money != undefined && row.refund_money != '' && row.refund_money != null && row.refund_money > 0){
            money = parseFloat(row.money) - parseFloat(row.refund_money)
          }else {
            money = row.money
          }
          let par = {
            payment_id:row.id,
            subject_name:row.subject_name,
            money:money,
            house_no:row.house_no
          }
          self.upstate({key:'public_bc',val:true})
          self.$emit('flushing',par)
        },
        /*-------------------------协议客户-----------------------------*/
        //获取协议客户
        getCustomerList() {
          let self = this
          let list = []
          if (self.agreement_customers != undefined && self.agreement_customers != null && self.agreement_customers.length > 0){
            let newList = JSON.parse(self.agreement_customers)
            let newArr = []
            for (let i = 0; i < newList.length; i++){
              newArr.push({
                key:newList[i].id,
                value:newList[i].name
              })
            }
            return newArr
          }
        },
        //协议客户输入框建议
        querySearch(queryString, cb) {
          var protocolCustomer = this.protocolCustomer;
          var results = queryString ? protocolCustomer.filter(this.createFilter(queryString)) : protocolCustomer;
          // 调用 callback 返回建议列表的数据
          cb(results);
        },
        createFilter(queryString) {
          return (restaurant) => {
            return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
          };
        },
        //输入的协议客户(监听协议客户变化，修改房费变化)
        handleSelect(val) {
          let self = this
          let userId = val.key
          let userList = JSON.parse(self.agreement_customers)
          for (let i = 0; i < userList.length; i++){
            if (userId == userList[i].id){
              self.project_id = userList[i].project_id
            }
          }
          self.algorithm(self.project_id)
        },
        //协议客户协议价格算法
        algorithm(projectId){
          let self = this
          let projectList = JSON.parse(self.agreement_projects)
          let agreement_projects = []
          for (let n = 0; n < projectList.length; n++){
            if (projectId == projectList[n].id){
              agreement_projects = projectList[n]
            }
          }
          let newArr = self.order_parameter
          for (let i = 0; i < newArr.length; i++){
            //溢价方式, 0为上浮,1为下降
            if (agreement_projects.premium_way == 0){
              //计算方式, 0为上浮比列,1为固定上涨
              if (agreement_projects.calculation_method == 0){
                newArr[i].agreement_price = parseFloat(self.oldList[i].agreement_price) * parseFloat(agreement_projects.calculation_value)
              }else if (agreement_projects.calculation_method == 1){
                newArr[i].agreement_price = parseFloat(self.oldList[i].agreement_price) + parseFloat(agreement_projects.calculation_value)
              }
            }else {
              //计算方式, 2为折扣,3为固定减价
              if (agreement_projects.calculation_method == 2){
                newArr[i].agreement_price = parseFloat(self.oldList[i].agreement_price) * parseFloat(agreement_projects.calculation_value)
              }else if (agreement_projects.calculation_method == 3){
                newArr[i].agreement_price = parseFloat(self.oldList[i].agreement_price) - parseFloat(agreement_projects.calculation_value)
              }
            }
          }
          self.roomPrcieChange()
        },
        /*-------------------------公共房费-----------------------------*/
        //接口请求失败，提示信息
        createMess(msg){
          let self = this
          self.upstate({key:'public_bc',val:false})
          this.$notify.error({
            title: '提示',
            message: msg
          });
        },
      }
    }
</script>

<style src="../../assets/less/boxContent.less" lang="less" scoped></style>
